PageRenderTime 55ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/baser/views/elements/sitemap.php

https://github.com/hashing/basercms
PHP | 55 lines | 34 code | 0 blank | 21 comment | 8 complexity | 13421d8fd2715efe41658b36d987c5d1 MD5 | raw file
Possible License(s): MIT
  1. <?php
  2. /* SVN FILE: $Id$ */
  3. /**
  4. * [PUBLISH] サイトマップ
  5. *
  6. * カテゴリの階層構造を表現する為、再帰呼び出しを行う
  7. * $bcBaser->sitemap() で呼び出す
  8. *
  9. * PHP versions 5
  10. *
  11. * baserCMS : Based Website Development Project <http://basercms.net>
  12. * Copyright 2008 - 2012, baserCMS Users Community <http://sites.google.com/site/baserusers/>
  13. *
  14. * @copyright Copyright 2008 - 2012, baserCMS Users Community
  15. * @link http://basercms.net baserCMS Project
  16. * @package baser.views
  17. * @since baserCMS v 0.1.0
  18. * @version $Revision$
  19. * @modifiedby $LastChangedBy$
  20. * @lastmodified $Date$
  21. * @license http://basercms.net/license/index.html
  22. */
  23. if(!isset($recursive)) {
  24. $recursive = 1;
  25. }
  26. $prefix = '';
  27. if(Configure::read('BcRequest.agent')) {
  28. $prefix = '/'.Configure::read('BcRequest.agentAlias');
  29. }
  30. ?>
  31. <ul class="sitemap section ul-level-<?php echo $recursive ?>">
  32. <?php if(isset($pageList['pages'])): ?>
  33. <?php foreach($pageList['pages'] as $page): ?>
  34. <?php if($page['Page']['title']): ?>
  35. <li class="sitemap-category li-level-<?php echo $recursive ?>"><?php $bcBaser->link($page['Page']['title'],$prefix.$page['Page']['url']) ?></li>
  36. <?php endif ?>
  37. <?php endforeach; ?>
  38. <?php endif ?>
  39. <?php if(isset($pageList['pageCategories'])): ?>
  40. <?php foreach($pageList['pageCategories'] as $pageCategories): ?>
  41. <li class="sitemap-page li-level-<?php echo $recursive ?>">
  42. <?php if(!empty($pageCategories['PageCategory']['url'])): ?>
  43. <?php $bcBaser->link($pageCategories['PageCategory']['title'], $prefix.$pageCategories['PageCategory']['url']) ?>
  44. <?php else: ?>
  45. <?php if(isset($pageCategories['children'])): ?>
  46. <?php echo $pageCategories['PageCategory']['title'] ?>
  47. <?php endif ?>
  48. <?php endif ?>
  49. <?php if(isset($pageCategories['children'])): ?>
  50. <?php $bcBaser->element('sitemap', array('pageList' => $pageCategories['children'], 'recursive' => $recursive+1)) ?>
  51. <?php endif ?>
  52. </li>
  53. <?php endforeach ?>
  54. <?php endif ?>
  55. </ul>