LoginSignup
2
2

More than 5 years have passed since last update.

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

Posted at

ページごとの分岐方法

スラッグが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; ?>
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2