ブレッドクラムの最後の項目に H1 タグを含める方法を見つけようとしています。H1 を使用しないサンプル コードを次に示します。
// Each tree item has a URL and name. Some may have extra_before and extra_after.
foreach ($context['lateral_navigation'] as $link_num => $tree)
{
echo '
<li', ($link_num == count($context['lateral_navigation']) - 1) ? ' class="last"' : '', '>';
// Show something before the link?
if (isset($tree['extra_before']))
echo $tree['extra_before'];
// Show the link, including a URL if it should have one.
echo $settings['lateral_navigation_link'] && isset($tree['url']) ? '
<a href="' . $tree['url'] . '">' . $tree['name'] . '
</a>' : '' . $tree['name'] . '';
// Show something after the link...?
if (isset($tree['extra_after']))
echo $tree['extra_after'];
echo '
</li>';
私は PHPer ではありませんが、次の行でコードを試してみました。
<li', ($link_num == count($context['lateral_navigation']) - 1) ? ' class="last"' : '', '>';
ブレッドクラムの最後の項目にのみ「最後」を表示するためです。
私はこれを以下で疲れさせましたが、明らかにうまくいきませんでした:
// Each tree item has a URL and name. Some may have extra_before and extra_after.
foreach ($context['lateral_navigation'] as $link_num => $tree)
{
echo '
<li', ($link_num == count($context['lateral_navigation']) - 1) ? ' class="last"><h1>' : '', '>';
// Show something before the link?
if (isset($tree['extra_before']))
echo $tree['extra_before'];
// Show the link, including a URL if it should have one.
echo $settings['lateral_navigation_link'] && isset($tree['url']) ? '
<a href="' . $tree['url'] . '">' . $tree['name'] . '
<div id="arrow">
<div class="inside"></div>
<div class="border"></div>
</div>
</a>' : '' . $tree['name'] . '';
// Show something after the link...?
if (isset($tree['extra_after']))
echo $tree['extra_after'];
// Don't show a separator for the last one.
if ($link_num != count($context['lateral_navigation']) - 1)
echo '';
echo '
</h1', ($link_num == count($context['lateral_navigation']) - 1) , '></li>';
}
これについて何か助けはありますか?