Blog

concrete5のテーマからページ関連の情報を取得するサンプル

Posted by admin at 17:41 日時 2014/06/16

<?php   // text ヘルパーのロード  $th = Loader::helper('text');  // 現在のページを取得  $c = Page::getCurrentPage();  ?>  <h1>ページ名:<?php echo $th->entities($c->getCollectionName())?></h1>  <p>日付:<?php echo $c->getCollectionDatePublic('Y.m.d')?></p>  <p>パス:<?php echo $th->entities($c->getCollectionPath())?></p>  <p>ページハンドル:<?php echo $th->entities($c->getCollectionHandle())?></p>  <p>ページタイプ:<?php echo $th->entities($c->getCollectionTypeName())?></p>  <p>ページタイプハンドル:<?php echo $th->entities($c->getCollectionTypeHandle())?></p>  <?php if($c->isAlias()): ?>  <p>このページはエイリアスです。</p>  <?php endif; ?>  <?php $pageTheme = $c->getCollectionThemeObject(); ?>  <p>テーマハンドル:<?php echo $th->entities($pageTheme->getThemeHandle())?></p>  <h2>説明</h2>  <p><?php echo $th->makenice($th->entities($c->getCollectionDescription()))?></p>  <?php  // ページ属性の処理はページリストブロックのテンプレートを参考に  $example_attribute = $c->getAttribute('example_attribute_handle');  ?>

ドキュメント:Pages Overview


Share this entry