SEARCH
行业动态

行业动态

【原创】SDCMS自用最全标签整理

2022-02-24

阅读:93

1、标题、关键词、描述 和 网站系统设置标签[top]
网站系统标签:

{webroot}作用:系统路径

{weburl}作用:网站URL

{sdcms[webcount]}作用:网站第三方流量统计代码

{sdcms[webicp]}作用:网站备案号

{sdcms[webname]}作用:显示网站名称

{sdcms[seotitle]}作用:显示优化标题

{sdcms[seokey]}作用:网站SEO关键字

{sdcms[seodesc]}作用:网站SEO描述

{webmode}作用:系统运行模式(数值:1为动态,2为伪静态,3为静态)

{htmldir}作用:静态模式下,生成文件目录

备注:sd_config表中的任意行数据均可通过下面的方式调用
举例,我们要调用表setkey字段值为”agreement”的setvalue的内容时,只需要这样书写即可
{sdcms[agreement]},即其中的”agreement”可替换为其他的字段名称
首页:

<title>{sdcms[seotitle]}</title>

<meta name=”Keywords” content=”{sdcms[seokey]}” />

<meta name=”Description” content=”{sdcms[seodesc]}” />

<meta name=”author” content=”{weburl}” />

<meta name=”copyright” content=”{weburl}” />

<link rel=”canonical” href=”{weburl}” />

列表页:

<title>{sdcms.iif(sdcms.strlen(seotitle)>0,seotitle,classname)}{if page>1}_第{page}页{/if}_{sdcms[webname]}</title>
<meta name=”Keywords” content=”{seokey}” />
<meta name=”Description” content=”{seodesc}” />
<meta name=”author” content=”{weburl}” />
<meta name=”copyright” content=”{weburl}” />
<link rel=”canonical” href=”{weburl}{sdcms.getcateurl(classid)}”/>

内容页:

<title>{title}{if page>1}_第{page}页{/if}_{classname}_{sdcms[webname]}</title>
<meta name=”Keywords” content=”{seokey}” />
<meta name=”Description” content=”{seodesc}” />
<meta name=”author” content=”{weburl}” />
<meta name=”copyright” content=”{weburl}” />
<link rel=”canonical” href=”{contenturl}”/>

友情链接:

文字友情链接:

{sdcms:rs top=”0″ table=”sd_expand_link” where=”islock=1 and islogo=0″ order=”id desc”}
{rs:eof}暂无链接{/rs:eof}
<a href=”{$rs[weburl]}” target=”_blank”>{sdcms.cutstr($rs[webname],20,0)}</a>
{/sdcms:rs}

图片友情链接:

{sdcms:rs top=”0″ table=”sd_expand_link” where=”islock=1 and islogo=1″ order=”id desc”}
{rs:eof}<li>没有资料</li>{/rs:eof}
<a href=”{$rs[weburl]}”><img src=”{$rs[weblogo]}” alt=”{$rs[webname]}” /></a>
{/sdcms:rs}

导航:

<li><a href=”{webroot}”>网站首页</a></li>
{sdcms:rs top=”0″ table=”sd_category” where=”followid=0 and ismenu=1″ order=”ordnum,cateid” var=”sdcms_rp:cateid”}
<li><a href=”{$rs[link]}” title=”{$rs[catename]}”{if $rs[modeid]=-2} target=”_blank”{/if}>{$rs[catename]}</a>
<ul class=”subnav”>
{sdcms:rp top=”0″ table=”sd_category” where=”followid=[sdcms_rp] and ismenu=1″ order=”ordnum,cateid”}
<li><a href=”{$rp[link]}” title=”{$rp[catename]}”{if $rp[modeid]=-2} target=”_blank”{/if}>{$rp[catename]}</a></li>
{/sdcms:rp}
</ul>
</li>
{/sdcms:rs}

调用单页:

——–【任意页面】调用单页简介———

{sdcms:rs table=”sd_model_page” where=”classid=1″}
{sdcms.dehtml($rs[intro])}
{/sdcms:rs}

——–【单页专用】调用单页内容———

{sdcms:rs table=”sd_model_page” top=”1″ where=”classid=[classid]”}
{sdcms.get_content_split($rs[content],htmlrule)}
{/sdcms:rs}
{if get_content_page<>””}<div class=”npage”>{get_content_page}</div>{/if}

2.常用公共函数,标签[asp]
截取字符串:

{sdcms.cutstr($rs[title],20,1)} – 截取字符串,并显示省略号,0不显示省略号

{sdcms.nohtml($rs[intro])} – 过滤html代码

{sdcms.cutstr(sdcms.nohtml($rs[intro]),200,1)} – 截取字符串并过滤html代码,并显示省略号

图片输出:

{if $rs[ispic]=1}{$rs[pic]}{else}{webroot}theme/default/images/nophoto.jpg{/if}

判断如果有图片,输出图片地址,没有就用默认的图片
日期输出:

{sdcms.getdate($rs[createdate],”.”,0)} — 月.日

{sdcms.getdate($rs[createdate],”.”,1)} — 年.月.日

{year($rs[createdate])} — 获取年份

{month($rs[createdate])} — 获取月份

{day($rs[createdate])} — 获取日期

if语句:{if $rs[ispic]=1} {elseif } {elseif } {else} {/if}

for循环:

{dim wayarr:wayarr=split($rs[downway],”,”)}
{for i=0 to ubound(wayarr)}
<li><a href=”” >{wayarr(i)}</a></li>
{/for}

这个是以下载地址为例,获取下载地址的个数,逐个输出

【内容页】输出tag

{for i=0 to ubound(tags)}<a href=”{webroot}plug/tags.asp?tag={server.urlencode(tags(i))}”>{tags(i)}</a> {/for}

【任意页面】查询一个内容时输出tag

{dim toptags:toptags=Split($rs[tags],”,”)}
{for i=0 to ubound(toptags)}
<a href=”{webroot}plug/tags.asp?tag={server.urlencode(toptags(i))}” rel=”category tag”>{toptags(i)}</a>
{/for}

【任意页面】查询多个内容时输出tags
{dim listtags,thistag}
—rs查询中—

<% thistag=$rs[tags]%>
<%listtags=Split(thistag,”,”)%>
{for i=0 to ubound(listtags)}<a href=”{webroot}plug/tags.asp?tag={server.urlencode(listtags(i))}” rel=”category tag”>{listtags(i)}</a> {/for}

join语句:

如何在列表页,输出自定义字段的内容!
(以文章模型news为例)
第一步在{sdcms:rs …… }中加入以下字段:
join=”left join sd_model_news on sd_content.id=sd_model_news.cid”
第二步在field参数里加上你要调用的字段
第三步{$rs[字段名]}
3.RS查询语句[rs]
内容查询:

{sdcms:re table=”sd_category” top=”1″ where=”modeid in (2,5)” order=”ordnum,cateid” var=”nid:cateid”}
{sdcms:rs top=”10″ field=”id,isurl,url,ispic,pic,title,style,classid,createdate” table=”sd_content” where=”classid in([sdcms.get_sonid(1)]) and islock=1″ order=”ontop desc,createdate desc”}
<li><a href=”{$rs[link]}” title=”{$rs[title]}”>{sdcms.cutstr($rs[title],90,1)}</a></li>
{/sdcms:rs}
{/sdcms:re}

输出图片:{if $rs[ispic]=1}{$rs[pic]}{else}{skins}/images/nophoto.jpg{/if}

【classid in([sdcms.get_sonid(1)])】–某个栏目及其下属所有栏目下的内容
【islock=1】– 已通过审核的内容
【isnice=1】– 推荐的内容,【ispic=1】– 带缩略图的内容
栏目查询:

{sdcms:re table=”sd_category” top=”1″ where=”cateid in (2,5)” order=”ordnum,cateid” var=”ctid:cateid”}
{sdcms:rs table=”sd_category” top=”0″ where=”followid = [ctid]” order=”ordnum,cateid” }
<li{if $rs[cateid]=classid} class=”hover”{/if}><a href=”{$rs[link]}”>{$rs[catename]}</a></li>
{/sdcms:rs}
{/sdcms:re}

【cateid in ([sdcms.get_sonid(1)]) 】–某个栏目及其下属所有栏目

【followid in ([parentid]) and depth=2】 –(栏目页)当前大类的二级栏目

【cateid in ([sonid]) or cateid in ([parentid])】 –(栏目页)当前大类及其下属所有级分类

【followid = [followid]】 — 当前栏目的下级栏目

【ismenu=1】– 是否是导航

【followid=1】栏目id为1的下属栏目,【depth=1】一级栏目

【sonid】– 子栏目字段,【parentid】– 父栏目字段,【modeid=-1】–模型id,-1表示为单页
join语句:

如何在列表页,输出自定义字段的内容!(以文章模型news为例)

第一步在{sdcms:rs …… }中加入以下字段:

join=”left join sd_model_news on sd_content.id=sd_model_news.cid”

第二步在field参数里加上你要调用的字段

第三步{$rs[字段名]}

排序:
【内容排序】
order=”ontop desc,id desc,lastupdate desc,createdate desc”
【栏目排序】
order=”ordnum,cateid”
模型查询:

<!–产品开始–>

{sdcms:re top=”1″ table=”sd_category” where=”modeid in (5,2)” order=”ordnum,cateid” var=”v_rp:cateid”}
{dim sjcp:sjcp=sdcms.get_sonid(v_rp)}

<!–下面再查询栏目或内容–>

{sdcms:rs top=”3″ field=”id,isurl,url,ispic,pic,title,style,classid,intro” table=”sd_content” where=”classid in([sjcp]) and islock=1″ order=”ontop desc,id desc”}
{/sdcms:rs}
{/sdcms:re}

<!–产品结束–>
随机:

【随机查询】
其他都一样
order=”rnd”

【内容分页】
pagesize=”{var pagenum}”
【自定义参数,参数从1+,最大值为rs结果集个数】
auto=”i”
4.列表页[list]
常用标签:

栏目名称 {classname} 栏目关键字 {seokey}
栏目描述 {seodesc} 优化标题 {seotitle}
栏目ID {classid} 栏目所有父ID {parentid}
分页数量 {pagenum} 栏目所有子ID {sonid}
栏目图片 {catepic} 栏目模型ID {modeid}

输出分类

{sdcms:rs top=”0″ table=”sd_category” where=”followid=[classid]” order=”ordnum,cateid” var=”cid:cateid”}
{sdcms:rp top=”0″ table=”sd_category” where=”followid=[cid]” order=”ordnum,cateid” var=”sid:cateid”}
{sdcms:rx top=”0″ table=”sd_category” where=”followid=[sid]” order=”ordnum,cateid”}
{/sdcms:rx}
{/sdcms:rp}
{/sdcms:rs}

———–经典案例——–
查询全部当前分类: where=”cateid in ([parentid]) or followid in ([parentid])”
查询当前下级分类: where=”followid in ([parentid])”
查询当前分类(除了一级分类):followid in ([parentid]) and depth=2
输出列表

{sdcms:rs field=”id,isurl,url,ispic,pic,title,style,classid,point,createdate” table=”sd_content” where=”classid in([sonid]) and islock=1″ order=”ontop desc,createdate desc” pagesize=”{var pagenum}”}
{rs:eof}<li>没有资料</li>{/rs:eof}
{/sdcms:rs}
<div class=”npage”>{showpage}</div>

查询内容

{sdcms:rs field=”id,isurl,url,ispic,pic,title,style,classid,point,createdate” table=”sd_content” where=”classid in([sonid]) and islock=1″ order=”ontop desc,createdate desc” pagesize=”{var pagenum}”}
{rs:eof}<li>没有资料</li>{/rs:eof}
{/sdcms:rs}
<div class=”npage”>{showpage}</div>

———–下面是单页内容输出————

{sdcms:rs table=”sd_model_page” top=”1″ where=”classid=[classid]”}
{sdcms.get_content_split($rs[content],htmlrule)}
{/sdcms:rs}
{if [get_content_page]<>””}<div class=”npage”>{get_content_page}</div>{/if}

查询栏目

{sdcms:rs table=”sd_category” top=”0″ where=”cateid in ([sdcms.get_sonid(1)])” order=”ordnum,cateid” var=”sdcms_cateid:cateid”}
{/sdcms:rs}
或者: where=”followid=2″

5.内容页[content]
常用标签:

所属栏目名称 {classname} 更新日期 {lastupdate}

标题 {title} 内容简介 {intro}

显示内容 {content} 缩略图 {pic}

作者 {author} 内容分页 {get_content_page}

内容url {contenturl} 人气 {hits}

标题CSS {style} 相关内容id {likeid}

不常用标签:

是否带图 {ispic} 内容的标签 {tags}

所属栏目ID {classid} 发布日期 {createdate}

所属父栏目ID {followid} 所属栏目的所有子类 {sonid}

所属栏目图片 {catepic} 所属栏目的所有父类 {parentid}

当前内容ID {id} 内容分页的当前页数 {page}

外链网址 {url} 是否为外链 {isurl}

上下篇

{sdcms:rs top=”1″ field=”*” table=”sd_content” where=”islock=1 and classid=[classid] and id<[id] and isurl=0″ order=”id desc”}{rs:eof}上一篇:没有了{/rs:eof}
上一篇:<a href=”{$rs[link]}”>{sdcms.cutstr($rs[title],90,1)}</a>
{/sdcms:rs}

{sdcms:rs top=”1″ field=”*” table=”sd_content” where=”islock=1 and classid=[classid] and id>[id] and isurl=0″}{rs:eof}下一篇:没有了{/rs:eof}
下一篇:<a href=”{$rs[link]}”>{sdcms.cutstr($rs[title],90,1)}</a>
{/sdcms:rs}

查内容

{sdcms:rs top=”6″ field=”*” table=”sd_content” where=”islock=1 and classid in ([sdcms.get_sonid(1)])” order=”ontop desc,id desc” auto=”i”}
{/sdcms:rs}

查栏目

{sdcms:rs table=”sd_category” top=”0″ where=”cateid in ([sdcms.get_sonid(1)])” order=”ordnum,cateid” var=”sdcms_cateid:cateid”}
{/sdcms:rs}

或者: where=”followid=2″

作者、人气

<p style=”margin:0px 0px 0px;”>作者:{if author<>””}{author}{else}本站{/if}来源:{if comefrom<>””}{comefrom}{else}本站{/if}日期:{createdate}人气:<span id=”hits”>{hits}</span></p>

=======人气要用到的js======

<script src=”{webroot}lib/js/jquery.js”></script>
<script>var webroot=”{webroot}”,infoid=”{rsshow[cid]}”,murl=”show.asp?id={id}”,contenturl=”{contenturl}”;</script>
<script src=”{webroot}lib/js/sdcms.hits.js”></script>

【内容页】输出tag

{for i=0 to ubound(tags)}<a href=”{webroot}plug/tags.asp?tag={server.urlencode(tags(i))}”>{tags(i)}</a> {/for}

11.制作幻灯片模块【banner】
步骤

第一种方法:【推荐】

在后台扩展》广告处,添加一个广告分类;

然后添加图片广告,添加的时候选择对应的分类

然后记下该分类的id,使用广告代码调取

第二种方法:

在后台栏目处,添加一个外链接作为一级栏目;

在此栏目下,添加子栏目作为幻灯片图片,上传图片

记下该一级栏目的id,调用图片的时候使用

查询logo【一个图】

{sdcms:rs top=”1″ field=”fileurl,url,title” table=”sd_expand_ad” where=”islock=1 and classid=1″ order=”ordnum,id”}{rs:eof}没有广告{/rs:eof}
<a href=”{$rs[url]}” target=”_blank”><img src=”{$rs[fileurl]}” alt=”{$rs[title]}” width=”740″ height=”230″ /></a>
{/sdcms:rs}

==========内页banner======
{if catepic=””}默认图片{else}{catepic}{/if}

广告调取【推荐】

{sdcms:rs top=”5″ field=”fileurl,url,title” table=”sd_expand_ad” where=”islock=1 and classid=1″ order=”ordnum,id”}
{rs:eof}没有广告{/rs:eof}
<li><a href=”{$rs[url]}” target=”_blank”><img src=”{$rs[fileurl]}” alt=”{$rs[title]}” width=”740″ height=”230″ /></a></li>
{/sdcms:rs}

查询扩展分类名称

{sdcms:rs top=”1″ field=”classname” table=”sd_expand_class” where=”classid=1″}
分类名称:{$rs[classname]}
{/sdcms:rs}

调用某个类别的名称、url、某个内容的url

1.类别名称{sdcms.getcatename(1)}

2.类别的Url{sdcms.getcateurl(1)}

3.带超链接的类别名称{sdcms.getcateinfo(1)}

4.单独调用某个内容的URL,其中1为内容的ID{sdcms.getcontenturl(1)}

5.获取当前栏目及其所有子栏目id{sdcms.get_sonid(1)}

6.过滤掉html代码,并再次截取前90个数字

{sdcms.cutstr(sdcms.nohtml($rs[intro]),90,1)}

当前位置:{sdcms.getpostion(parentid,” > “)}

内容简介:{sdcms.cutstr(sdcms.nohtml($rs[intro]),90,1)}

自定义字段调取:{rsshow[字段名]}

  • GanZhou
  • DongGuan
  • ShenZhen
  • GuangZhou
  • JiuJiang

ADD:赣州市南康区龙岭经济开发区

TEL:136-6297-4469

ADD:东莞市常平镇星汇置地16层

TEL:181-2288-6265

ADD:深圳市宝安区沙井南环路188号

TEL:136-6297-4469

ADD:广州地铁一号线黄沙站附近

TEL:181-2288-6265

ADD:九江市长虹大道东方俊园15楼

TEL:136-6297-4469

Wechat