输出所有独立页面的超链接,一般用于显示在菜单上,或者网站底部

<?php \Widget\Contents\Page\Rows::alloc()->to($pages); ?>
  <?php while ($pages->next()): ?>
        <a<?php if ($this->is('page', $pages->slug)): ?> class="current"<?php endif; ?> href="<?php $pages->permalink(); ?>" title="<?php $pages->title(); ?>"><?php $pages->title(); ?></a>
  <?php endwhile; ?>

其中<?php if ($this->is('page', $pages->slug)): ?> class="current"<?php endif; ?>是判断当前页面缩略名是否等于独立页面列表中的某个独立页面,等于则对超链接追加独立的class使其样式与其他作为区别。

最后修改:2024 年 05 月 05 日
如果觉得我的文章对你有用,请随意赞赏