【baserCMS:初心者向け】ページごとの分岐方法


ページごとの分岐方法

スラッグがworkのページのみに表示したいコンテンツがある場合

<?php if (strtolower($this->BcBaser->getContentsName()) === 'work'): ?>
〜コンテンツ〜
<?php endif; ?>

スラッグがworkのページのみに表示したくないコンテンツがある場合(work以外のページに表示)

<?php if (strtolower($this->BcBaser->getContentsName(true)) !== 'work'): ?>
〜コンテンツ〜
<?php endif; ?>

複数ページ分岐
スラッグがpolicyとfaqのページ以外のページで表示したいコンテンツがある場合

<?php
$slug = strtolower($this->BcBaser->getContentsName(true));
if ($slug !== 'policy' && $slug !== 'faq'): ?>
〜コンテンツ〜
<?php endif; ?>