Z-Blog特定分类文章列表的调用
在Z-Blog中,我们往往希望单独调用某分类的文章列表,在1.8版本中,我们可以修改主题模板做到这一点。
我们将利用Z-Blog 1.8版中增强的INCLUDE目录文件调用功能,调用程序生成的各分类最新文件列表缓存文件。
1.8 版中,Z-Blog是默认不生成分类文章列表的,所以我们需要修改 FUNCTION/c_system_event.asp 文件中索引重建函数“MakeBlogReBuild”的代码,将“'BlogReBuild_Categorys”(约1616行)这一行前的单引号删掉,即取消掉注释状态,保存后覆盖服务器上该文件。即将发布的插件即为控制重建索引时具体重建哪些索引缓存的程序。
在首页调用某分类最新文章列表
在首页调用某分类文章列表,可以使用
<#CACHE_INCLUDE_CATEGORY_id#>
其中最后的 id 请更换为具体分类ID,可在后台分类管理中查看到。
在分类页调用该分类最新文章列表
在分类页调用该分类最新文章列表,可以使用
<#CACHE_INCLUDE_CATEGORY_<#articlelist/category/id#>#>
其中
<#articlelist/category/id#>
将自动被程序替换为分类ID。
我们可以在动态页模板 /THEMES/your theme/TEMPLATE/catalog.html 的侧边栏div中加入如下代码:
<h3>分类最新更新</h3>
<ul class="sidemenu">
<#CACHE_INCLUDE_CATEGORY_<#articlelist/category/id#>#>
</ul>
<h3>分类最新更新</h3><br/><ulclass="sidemenu"><br/><#CACHE_INCLUDE_CATEGORY_<#articlelist/category/id#>#>
<br/></ul><br/>
在文章页面调用所在分类最新文章列表
因为文章页为静态页,所以调用方法将不同于以上动态页的代码。
在需要插入列表的地方加入
<script type="text/javascript">strBatchInculde+="ulCategory=category_<#article/category/id#>,";</script>
,其中 ulCategory 为列表所在UL或OL元素的ID。如在文章页模板 /THEMES/your theme/TEMPLATE/single.html 的侧边栏div中加入如下代码:
<h3><#article/category/name#></h3>
<ul class="sidemenu" id="ulCategory">
<script type="text/javascript">strBatchInculde+="ulCategory=category_<#article/category/id#>,";</script>
</ul>
<h3><#article/category/name#></h3><br/><ulclass="sidemenu" id="ulCategory"><br/><scripttype="text/javascript">
strBatchInculde+="ulCategory=category_<#article/category/id#>,";</script><br/></ul><br/>
其中
<#article/category/name#>
将自动替换为所在分类名称。更多模板标题请参见Z-Blog Wiki。
评论(0)▼