差别
这里会显示出您选择的修订版和当前版本之间的差别。
— |
themes:crumbs [2013/10/21 06:55] (当前版本) |
||
---|---|---|---|
行 1: | 行 1: | ||
+ | ====== 页面面包屑 ====== | ||
+ | **什么是面包屑?** | ||
+ | 面包屑通常用来展示页面在站点中的位置,使访客不会迷失方向,如:Home » Journal » Hello World | ||
+ | 在blog中,我们看看会有哪些路径出现: | ||
+ | > __首页__ » 最新文章 | ||
+ | > __首页__ » __分类名称__ » 文章标题 | ||
+ | > __首页__ » 归档年份 » 归档月份 | ||
+ | > __首页__ » 页面名称 | ||
+ | > __首页__ » 分类名称 | ||
+ | > __首页__ » 标签名称 | ||
+ | > __首页__ » 搜索关键词或其他信息 | ||
+ | 有下划线的文字代表是一个链接 | ||
+ | |||
+ | 实际上title中的内容可以直接移植到我们的面包屑中,在看下面的代码之前,也许你需要先温习[[themes:is-syntax|神奇的is语法]]。 | ||
+ | <code php> | ||
+ | <div class="crumbs_patch"> | ||
+ | <a href="<?php $this->options->siteUrl(); ?>">Home</a> »</li> | ||
+ | <?php if ($this->is('index')): ?><!-- 页面为首页时 --> | ||
+ | Latest Post | ||
+ | <?php elseif ($this->is('post')): ?><!-- 页面为文章单页时 --> | ||
+ | <?php $this->category(); ?> » <?php $this->title() ?> | ||
+ | <?php else: ?><!-- 页面为其他页时 --> | ||
+ | <?php $this->archiveTitle(' » ','',''); ?> | ||
+ | <?php endif; ?> | ||
+ | </div> | ||
+ | </code> | ||
+ | |||
+ | 将上面的代码放在需要显示的页面,例如index.php、post.php,抑或是header.php页面,保存后就可以查看结果,当然别忘了自定义样式哦。 |