首页模块显示 - zblog主题助手
准备工作
1、当前主题需要有template.json
2、安装并启动《zblog主题助手》插件
步骤
1、拆分首页模块。
这里已图文模块为例,在template文件夹下创建自定义文件名,比m-tuwen.php,案例代码如下:
<div class="content" id="imgtxt">
<h2>{if $cname->ID == 0}最新发布{else}{$cname.Name}{/if}</h2>
{if $cname->ID != 0 && $cname->Intro}<p>{$cname->Intro}</p>{/if}
<div class="img-txt-list">
{php}
$w=array();$w['count']=$reg['num'];$w['cate']=$reg['category'];
$array=GetList($w);
{/php}
{foreach $array as $key=>$related}
<div class="img-txt-list-box-content">
<a href="{$related.Url}" class="post">
<img src="{$related.Img}" alt="">
<h3>{$related.Title}</h3>
<p class="post-intro">{$related.Intro}</p>
</a>
</div>
{/foreach}
</div>
</div>字段说明:
模块传递的值在$reg里面,里面2个可用值。
分类ID:$reg['category'] 显示数量:$reg['num']
2、在template.json里面定义模块描述,添加描述数组
{
"filename": "m-tuwen",
"type": "module",
"name": "图文模块"
}3、在首页删除拆分的模块,替换以下代码
{template:ytecn_module/module}4、然后这个时候就可以去《zblog主题助手》中的《配置中心》页面控制模块显示了。
“首页模块显示 - zblog主题助手” 的相关文章
post表添加新字段5个月前 (06-18)
在后台文章列表页面添加二级目录5个月前 (06-18)
zblog网站搬家教程5个月前 (06-18)
提供免费代安装全新的zblogphp程序5个月前 (06-18)


