全局变量

名称 用法 备注
网站名称 {$RETENG['site_name']} 如:热腾网
网站地址 {$RETENG['site_url']} 如:http://www.reteng.org
网站路径 {$RETENG['retengcms_path']} 如:/ 或 /retengcms/
模板名称 {$RETENG['tlp_name']} 网站模板定义的名称
模板路径 {$RETENG['tlp_path']} 如:/template/模板文件夹名/
网站备案号 {$RETENG['icpno']}  
网站版权 {$RETENG['copyright']}  
网站seo标题 {head['title']}  
网站关键字 {$head[keywords]}  
网站描述 {$head[description]}  
全部自定义标签 {$RETENG['变量名称']} 在后台"基本配置"-"添加变量"中自定义

栏目列表调用

功能说明: 获取当前频道列表。

适用范围: 全局使用。

基本语法:

{reteng:category type="top" nav="2" row="8"}
<a href="{field:url}">{field:catname}</a>
{/reteng:category}

带有样式的导航标签
<a href="/"{if !isset($id)} class="a"{/if}>首页</a>
{reteng:category type="top" nav="2" row="8"}
<a href="{field:url}"{if $catid==$id} class="a"{/if}>{field:catname}</a>
{/reteng:category}

当前子栏目调取:

{reteng:category parentid="field:id" row="10" mod="1,2,4" type="son"}
<a href="{field:url}">{field:catname}</a>
{/reteng:category}

参数说明:

参数 说明
nav="2" 导航分组(1.顶部导航、2.主导航、3.底部导航)分组根据后台行设置
row="8" 获取频道条数
type="top" 调用类型 top 顶级分类,self同级分类,son子级分类
mod="1,2,4" 模型类型,1文字,2单页,3,系统,比如会员等,4外部连接
parentid="0" 父级栏目id
offset="0" 从第几条开始调用
catid="0" 调用栏目ID,可选,一般内页做相关分类的时候需要用到
id="0" 调用id,可选

栏目、单页标签

栏目、单页标签函数:category
应用格式:{reteng:category}html模版{/reteng:category}

可用字段:

调用字段 字段说明
field:id 栏目id
field:modelid 模型ID
field:parentid 父级ID
field:type 栏目类型
field:catname 栏目名称
field:domain 栏目绑定域名
field:catdir 栏目目录
field:url 栏目连接地址
field:setting

栏目设置为数组类型,调用的时候,需要转换{retengcms:$rs=string2array(field:setting)},
然后可以调用设置例如:{$rs['meta_title']} seo设置,{$rs['meta_keywords']}seo关键词,{$rs['meta_description']}seo描述

field:siteid 站点id
field:content 栏目内容,如果为单页的时候需要
field:navtype 导航分组
field:_自定义名称 其他自定义字段

内容列表调取方法

{reteng:content row='3' limit="0" withthumb="1" catid="$catid" infolen="150"}
<a title="{field:title}" href="{field:url}"><img width="110" height="110" src="{field:thumb}" alt="{field:title}" /></a>
<a href="{field:url}" title="{field:title}">{sub_string(field:title,46)}</a>
<p>{sub_string(field:description,100,'...')}</p>
{/reteng:content}

注:

limit="0"   起始,结束 表示限定的记录范围(如:limit='1,2')
withthumb="1"  图文内容调取(如:1.为调取带有图片的文章,0.为调取无图片的文章)
infolen="150"  截取描述字数
titlelen="10"  截取标题显示字数

热门文章

{reteng:content row="1" titlelen="14" withthumb=1 orderby="updatetime DESC" ismore="0" infolen=150}
<a href="{field:url}" target="_blank"><img src="{field:thumb}"/></a>
<p><a href="{field:url}" target="_blank" title="{field:fulltitle}">{field:title}</a></p>
<p class="text">{field:description}</p>
{/reteng:content}
热门文章
{reteng:content row="9" titlelen="40" orderby="clicks DESC" ismore="0"}
<a href="{field:url}" target="_blank" title="{field:fulltitle}">{field:title}</a>
{/reteng:content}

热门标签

{if md_installed('tags')}
<h3>热门标签</h3>
{table:tagindex row=20}<a href="/tags/?tag={field:tag}">{field:tag}</a> {/table:tagindex}
{/if}

相关栏目

{if ishaschildren($catid)}
<h3>相关栏目</h3>
{reteng:category parentid="$pid" type="son"}
<a href="{field:url}" target="_blank">{field:catname}</a>
{/reteng:category}
{/if}

推荐文章

{reteng:content catid="$catid" posid="3" row="10" limit="0" withthumb="0"}
<a title="{field:title}" href="{field:url}">{sub_string(field:title,38,'...')}</a>
{/reteng:content}

注:posid="3"推荐显示的页面

最新评论

{reteng:comment contentid="0" row="5" page="0"}
<a href="{$RETENG[retengcms_path]}comment/index.php?contentid={field:contentid}" target="_blank"><img src="{field:userface}"></a>
<a href="{$RETENG[retengcms_path]}comment/index.php?contentid={field:contentid}" target="_blank">{field:username}</a>
{field:content}
{/reteng:comment}

相关文章

{reteng:content row="10" keyword="$keywords"}
<a title="{field:title}" href="{field:url}">{field:title}</a><span>({date('Y-m-d',field:updatetime)})</span>
{/reteng:content}

单页内容截取调用

{reteng:category catid="1"}{sub_string(strip_tags(field:content),280,'...')}{/reteng:category}

注:catid="1" 单页ID

内容页面:上一篇;下一篇文章

上一篇:{getpre($id,$catid,60)}
下一篇:{getnext($id,$catid,60)}

预设函数介绍:

调用标签 标签作用说明
{catname($catid)} 获取栏目名称
{caturl($catid)} 获取栏目地址
{catimage($catid)} 获取栏目封面图片地址
get_pos($catid=0,$separator='') 获取当前位置$catid栏目id,$separator为分隔字符
{strtojpg($str,$width='100',$height='24')} 将文本转换成图片
{get_images($str)} 获取一段文本中的所有图片
{getcururl()} 获取当前地址
{sub_string($string, $length, $dot='')} $dot='')} 字符截取函数,$string是要截取的字符串,$length是截取长度数
{string2array($str)} 字符串转换成数组
{explorer_version()}

获得浏览器的类型

{getparentid($catid)} 获取一个栏目的父级id,如果catid为顶级栏目,那么返回的是0
{isfinalcatid($catid)} 判断一个栏目是否为最终栏目
{ishaschildren($catid)} 判断一个栏目是否有子栏目
{gettopparentid($catid)} 获取一个栏目的顶级栏目id

普通变量:

变量 说明
{$catid} 栏目ID 这个实用于 内页(列表,文字展示,单页,频道首页)
{$id} ID编号,如果在列表页中调用则是,栏目id,如果在文章页中则是文章id
{$page} 当前分页
{$reteng_postion} 当前位置
{$reteng_catname} 当前栏目名称,不推荐使用一般使用{catname($catid)}
{$no} retengcms循环计数器,实用:category,content,loop标签中,从0开始,如果需要从1开始,那么{retengcms $pno=$no+1;}

模板嵌入调用

retengcms常用标签

{tlp 文件名} 引用一个文件
{retengcms } 是前端转换成php运行

实际应用:

{tlp head} 包含 头部文件
{retengcms $aa;} 定义一个$aa的变量

其他常用标签

{catname(3)}   调取栏目ID为3的栏目名
{catname($catid)}   调取当前栏目名
{field:autoindex}   循环计数

更多标签调用可参考网站后台相关模型。