SDCMS2.0、3.0最全标签整理

发布时间:2025-12-09 21:58:22 浏览次数:4

1、标题、关键词、描述 和 网站系统设置标签
网站系统标签:
{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”可替换为其他的字段名称

首页:

{sdcms[seotitle]}

列表页:

{sdcms.iif(sdcms.strlen(seotitle)>0,seotitle,classname)}{if page>1}_第{page}页{/if}_{sdcms[webname]}

内容页:

{title}{if page>1}_第{page}页{/if}_{classname}_{sdcms[webname]}

友情链接:
文字友情链接:
{sdcms:rs top=”0″ table=”sd_expand_link” where=”islock=1 and islogo=0″ order=”id desc”}
{rs:eof}暂无链接{/rs:eof}
{sdcms.cutstr(KaTeX parse error: Expected 'EOF', got '}' at position 18: …[webname],20,0)}̲</a> {/sdcms:rs…rs[weburl]}”>
{/sdcms:rs}

导航:

  • 网站首页
  • {sdcms:rs top=”0″ table=”sd_category” where=”followid=0 and ismenu=1″ order=”ordnum,cateid” var=”sdcms_rp:cateid”}
  • 调用单页:
    ——–【任意页面】调用单页简介———
    {sdcms:rs table=”sd_model_page” where=”classid=1″}
    {sdcms.dehtml(KaTeX parse error: Expected 'EOF', got '}' at position 11: rs[intro])}̲ {/sdcms:rs} ——…rs[content],htmlrule)}
    {/sdcms:rs}
    {if get_content_page<>””}

    {get_content_page} {/if}

    2.常用公共函数,标签[asp]
    截取字符串:
    {sdcms.cutstr(KaTeX parse error: Expected 'EOF', got '}' at position 16: rs[title],20,1)}̲ – 截取字符串,并显示省略号…rs[intro])} – 过滤html代码
    {sdcms.cutstr(sdcms.nohtml($rs[intro]),200,1)} – 截取字符串并过滤html代码,并显示省略号

    图片输出:
    {if KaTeX parse error: Expected 'EOF', got '}' at position 12: rs[ispic]=1}̲{rs[pic]}{else}{webroot}theme/default/images/nophoto.jpg{/if}

    判断如果有图片,输出图片地址,没有就用默认的图片
    日期输出:
    {sdcms.getdate(KaTeX parse error: Expected 'EOF', got '}' at position 22: …atedate],”.”,0)}̲ — 月.日 {sdcms.g…rs[createdate],”.”,1)} — 年.月.日
    {year(KaTeX parse error: Expected 'EOF', got '}' at position 16: rs[createdate])}̲ — 获取年份 {month(rs[createdate])} — 获取月份
    {day($rs[createdate])} — 获取日期

    if语句:{if KaTeX parse error: Expected 'EOF', got '}' at position 12: rs[ispic]=1}̲ {elseif } {els…rs[downway],”,”)}
    {for i=0 to ubound(wayarr)}

  • {wayarr(i)}
  • {/for}

    这个是以下载地址为例,获取下载地址的个数,逐个输出
    【内容页】输出tag
    {for i=0 to ubound(tags)}<a href=”{webroot}plug/tags.asp?tag={server.urlencode(tags(i))}”>{tags(i)} {/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)}
    {/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)} {/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”}

  • {sdcms.cutstr($rs[title],90,1)}
  • {/sdcms:rs} {/sdcms:re}

    输出图片:{if KaTeX parse error: Expected 'EOF', got '}' at position 12: 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 KaTeX parse error: Expected 'EOF', got '}' at position 19: …cateid]=classid}̲ class=”hover”{…rs[link]}”>{$rs[catename]}
    {/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}

  • 没有资料
  • {/rs:eof}
    {/sdcms:rs} {showpage}

    查询内容

    {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}

  • 没有资料
  • {/rs:eof}
    {/sdcms:rs} {showpage}

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

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

    {get_content_page} {/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}
    上一篇:{sdcms.cutstr($rs[title],90,1)}
    {/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}
    下一篇:{sdcms.cutstr($rs[title],90,1)}
    {/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″

    作者、人气

    =人气要用到的js

    【内容页】输出tag

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

    {/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}

  • {/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[字段名]}

需要做网站?需要网络推广?欢迎咨询客户经理 13272073477