我一直在试图弄清楚如何使我的面包屑中的最后一项在其中包含 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>';
}
有什么帮助吗?