说明:本系统所有的模块位于/module/下
问:如何快速找到WMCMS相关模块能使用的公共标签和条件?
答:
1.需要找到你需要查找的模块,如小说模块novel。
2.找能够使用的公共标签 novel.label.php(注:每个模块的标签文件名字统一为 [模块名].label.php)
找到该文件的如下方法
static function PublicLabel()
{
//数组键:类名,值:方法名
$repFun['t']['novellabel'] = 'PublicType';
tpl::Label('{小说分类:[s]}[a]{/小说分类}','type', self::$CF, $repFun['t']);
tpl::Label('{二级小说分类:[s]}[a]{/二级小说分类}',array('type','二级'), self::$CF, $repFun['t']);
tpl::Label('{三级小说分类:[s]}[a]{/三级小说分类}',array('type','三级'), self::$CF, $repFun['t']);
//小说标签
$repFun['a']['novellabel'] = 'PublicNovel';
tpl::Label('{推荐小说:[s]}[a]{/推荐小说}','rec', self::$CF, $repFun['a']);
tpl::Label('{限时小说:[s]}[a]{/限时小说}','timelimit', self::$CF, $repFun['a']);
tpl::Label('{小说:[s]}[a]{/小说}','content', self::$CF, $repFun['a']);
//小说章节
$repFun['a']['novellabel'] = 'PublicChapter';
tpl::Label('{小说章节:[s]}[a]{/小说章节}','chapterlist', self::$CF, $repFun['a']);
}其中的 label为可以使用的标签
tpl::Label('{小说分类:[s]}[a]{/小说分类}'那么在模版中你就可以使用如下标签
{小说分类:【你的条件】}
【你的模版代码】
{/小说分类}
3.找能够使用的公共标签的条件 novel.class.php(注:每个模块的标签条件文件名字统一为 [模块名].class.php)
找到该文件的如下方法
static function GetWhere($where,$type='type')
{
.............
//设置需要替换的字段
$arr = array(
'tid' =>$typeField,
'type_id' =>$typeField,
'分类' =>$typeField,
'分类排序' =>'type_order',
'分类顺序' =>'t.type_id',
'分类倒序' =>'t.type_id desc',
'父级分类' =>'type_topid',
'小说作者id' =>'article_author_id',
'推荐顺序' =>'rec_order',
'推荐倒序' =>'rec_order desc',
.............
'顶' =>'novel_ding desc',
'踩' =>'novel_cai desc',
'评论' =>'novel_replay desc',
'评分' =>'novel_score desc',
'字数' =>'novel_wordnumber desc',
'日点击' =>'novel_todayclick desc',
'是' =>'1',
'否' =>'0',
'小说进程' =>'novel_process',
'连载中' =>'1',
'已完结' =>'2',
'已断更' =>'3',
'分卷id' =>'chapter_vid',
'章节顺序' =>'chapter_order',
'章节倒序' =>'chapter_order desc',
);
return tpl::GetWhere($where,$arr);
}其中array之间的部分为你可以使用的条件,如
'tid' =>$typeField,
那么在模版中你就可以使用如下标签和条件
{小说分类:tid=1;排序=分类顺序}
【你的模版代码】
{/小说分类}
------------------------
当然,除此之外你还可以直接使用数据库的字段名。如:
{小说分类:type_id=1;排序=type_order desc}
【你的模版代码】
{/小说分类}
数据库字段可以参wmcms数据库字典:http://data.weimengcms.com/





