请选择 进入手机版 | 继续访问电脑版

sdcms标签调用(asp旧版)

[复制链接]
admin 发表于 2020-8-26 07:04:44 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题
[backcolor=rgba(255, 255, 255, 0.9)]模板防盗:<%if not in_sdcms then response.write("template load fail"):response.end() end if%>
[backcolor=rgba(255, 255, 255, 0.9)]--------------
seo标题:
{sdcms[webname]}{sdcms[seotitle]}
seo关键词:
{seokey}
seo描述:
{seodesc}
--------------
[backcolor=rgba(255, 255, 255, 0.9)]文件路径例如:images路径:{webroot}theme/default/images/

[backcolor=rgba(255, 255, 255, 0.9)]--------------
模板引用:
{sdcms:include("sdcms_head.asp")}
{sdcms:include("sdcms_foot.asp")}
--------------
获取单个栏目:
{sdcms.getcateurl(1)} 获得栏目1的链接
{sdcms.getcatename(1)} 栏目名称
[backcolor=rgba(255, 255, 255, 0.9)]--------------

[backcolor=rgba(255, 255, 255, 0.9)]1.首页调用单页简介的方法为:
[backcolor=rgba(255, 255, 255, 0.9)]{sdcms:rs table="sd_model_page" where="classid=1"}
{sdcms.dehtml($rs[intro])}
{/sdcms:rs}
[backcolor=rgba(255, 255, 255, 0.9)]2.首页调用单页内容的方法为:
[backcolor=rgba(255, 255, 255, 0.9)]{sdcms:rs table="sd_model_page" where="classid=1"}
{$rs[content]}
{/sdcms:rs}
[backcolor=rgba(255, 255, 255, 0.9)]--------------
[backcolor=rgba(255, 255, 255, 0.9)]调用几条内容
{sdcms:rs table="sd_content" top="4" where="classid=1" auto="j"}  条件 islock=1只显示没删除的
<li><a href="{$rs[link]}"><img src="{$rs[pic]}">{$rs[title]}</a></li>
{/sdcms:rs}
classid=1 栏目id,top="4"调用4条
数据表sd_content其他字段:id、pic、createdate、lastupdate、style、ispic、tags、keyword、description、intro(详情)
调用详情前70个字符(过滤html){sdcms.cutstr(sdcms.nohtml($rs[intro]),70,1)}
[backcolor=rgba(255, 255, 255, 0.9)]时间格式
{sdcms.getdate($rs[createdate],"-",1)}

[backcolor=rgba(255, 255, 255, 0.9)]调取自定义字段的方法:
[backcolor=rgba(255, 255, 255, 0.9)]{sdcms:rs table="sd_content" top="20" where="classid=12" var="sdcms_dim:id" auto="j"}  //var="sdcms_dim:id"定义一个值,作为传给下个循环的条件
[backcolor=rgba(255, 255, 255, 0.9)]    {sdcms:rp table="sd_model_news" top="20" where="cid=[sdcms_dim]"} //sd_model_news 不同模型表不一样
[backcolor=rgba(255, 255, 255, 0.9)]    {$rp[新增的字段]}
[backcolor=rgba(255, 255, 255, 0.9)]  {/sdcms:rp}
[backcolor=rgba(255, 255, 255, 0.9)]{/sdcms:rs}

[backcolor=rgba(255, 255, 255, 0.9)]--------------
[backcolor=rgba(255, 255, 255, 0.9)]获取一某个栏目的所有子栏目: {dim dim_sonid:dim_sonid=sdcms.get_sonid("15")}
[backcolor=rgba(255, 255, 255, 0.9)]调用几个栏目
{sdcms:rs table="sd_category" top="10" where="ismenu=1" order="ordnum"}
<li><a href="{$rs[link]}">{$rs[catename]}</a></li>
{/sdcms:rs}

[backcolor=rgba(255, 255, 255, 0.9)]多级栏目:
[backcolor=rgba(255, 255, 255, 0.9)]{sdcms:rp table="sd_category" top="0" where="followid=[classid] and modeid>0" order="ordnum,cateid" var="sdcms_dim:sonid" auto="j"}
<div class="b{if j>1} mt10{/if} w670">
<div class="subject"><span><a href="{$rp[link]}">更多>></a></span>{$rp[catename]}</div>
<div class="p10">
<ul class="toplist">
{sdcms:rs top="10" field="id,title,style,createdate,isurl,url,classid" table="sd_content" where="islock=1 and classid in([sdcms_dim])" order="ontop desc,id desc"}
<li><span>{sdcms.getdate($rs[createdate],"-",1)}</span><a href="{$rs[link]}" title="{$rs[title]}"{if $rs[isurl]=1} target="_blank"{/if} {$rs[style]}>{sdcms.cutstr($rs[title],70,1)}</a></li>
{/sdcms:rs}
</ul>
</div>
</div>
{/sdcms:rp}

[backcolor=rgba(255, 255, 255, 0.9)]头部栏目nav模板:
[backcolor=rgba(255, 255, 255, 0.9)]{sdcms:rs top="0" table="sd_category" where="followid=0 and ismenu=1" order="ordnum desc,cateid" var="sdcms_rp:cateid"}
<li><a href="{$rs[link]}">{$rs[catename]}</a>
<dl>
{sdcms:rp top="0" table="sd_category" where="followid=[sdcms_rp] and ismenu=1" order="ordnum,cateid"}
<dd><a href="{$rp[link]}">{$rp[catename]}</a></dd>
{/sdcms:rp}
</dl>
</li>
{/sdcms:rs}


[backcolor=rgba(255, 255, 255, 0.9)]内页册栏目:通用万能调用方法
[backcolor=rgba(255, 255, 255, 0.9)]{if sonid / [classid] =1}//如果当前子栏目就是自己
{sdcms:rs table="sd_category" top="10" where="ismenu=1 and followid = [followid]" order="ordnum"}
<span {if $rs[cateid]=[classid]}class="cur"{/if}><a class="h3_a" href="{$rs[link]}">◇ {$rs[catename]}</a></span>
{/sdcms:rs}
{else}//否则
{sdcms:rs table="sd_category" top="10" where="ismenu=1 and followid in ([sonid])" order="ordnum"}
<span {if $rs[cateid]=[classid]}class="cur"{/if}><a class="h3_a" href="{$rs[link]}">◇ {$rs[catename]}</a></span>
{/sdcms:rs}
{/if}
[backcolor=rgba(255, 255, 255, 0.9)]------------------------
[backcolor=rgba(255, 255, 255, 0.9)]判断是否有子栏目
[backcolor=rgba(255, 255, 255, 0.9)]{sdcms:rs table="sd_category" top="0" where="followid=[classid] and ismenu=1" order="ordnum desc"}

{rs:eof}
{sdcms:rp table="sd_category" top="0" where="followid=[followid] and ismenu=1" order="ordnum desc"}

<li><a href="{$rp[link]}">{$rp[catename]}</a></li>
{/sdcms:rp}
{/rs:eof}

<li><a href="{$rs[link]}">{$rs[catename]}</a></li>
{/sdcms:rs}


[backcolor=rgba(255, 255, 255, 0.9)]栏目高亮判断条件:{if $rs[cateid]=[classid] or $rs[cateid]=[followid]} class="cur"{/if}

[backcolor=rgba(255, 255, 255, 0.9)]--------------
友情链接
{sdcms:rs top="0" table="sd_expand_link" where="islock=1" order="id desc"}
<a href="{$rs[weburl]}" target="_blank">{$rs[webname]}</a>
{/sdcms:rs}
参数:islogo=0
[backcolor=rgba(255, 255, 255, 0.9)]
--------------
[backcolor=rgba(255, 255, 255, 0.9)]
if判断格式
{if i mod 5=0}<li class="mid"></li>{/if}

[backcolor=rgba(255, 255, 255, 0.9)]--------------
[backcolor=rgba(255, 255, 255, 0.9)]前栏目名字
您所在的位置:<a href="{webroot}">首页</a>{sdcms.getpostion(parentid," > ")}
[backcolor=rgba(255, 255, 255, 0.9)]--------------
[backcolor=rgba(255, 255, 255, 0.9)]单篇调用内容 方法
[backcolor=rgba(255, 255, 255, 0.9)]{sdcms:rs table="sd_model_page" top="1" where="classid=[classid]"}
{sdcms.get_content_split($rs[content],htmlrule)}
{/sdcms:rs}
[backcolor=rgba(255, 255, 255, 0.9)]详情页 专用
[backcolor=rgba(255, 255, 255, 0.9)]{title} 标题
作者:{author} 来源:{comefrom} 日期:{createdate}
{content} 内容
[backcolor=rgba(255, 255, 255, 0.9)]调取自定义字段
[backcolor=rgba(255, 255, 255, 0.9)]{rsshow[字段名]}


[backcolor=rgba(255, 255, 255, 0.9)]<div class="pre">上一篇:{sdcms:rs top="1" field="id,isurl,url,title,style,classid" table="sd_content" where="islock=1 and classid=[classid] and id<[id] and isurl=0" order="id desc"}
{rs:eof}<span class="c9">没有资料</span>{/rs:eof}
<a href="{$rs[link]}" title="{$rs[title]}">{sdcms.cutstr($rs[title],70,1)}</a>
{/sdcms:rs}</div>

[backcolor=rgba(255, 255, 255, 0.9)]<div class="next">下一篇:{sdcms:rs top="1" field="id,isurl,url,title,style,classid" table="sd_content" where="islock=1 and classid=[classid] and id>[id] and isurl=0"}
{rs:eof}<span class="c9">没有资料</span>{/rs:eof}
<a href="{$rs[link]}" title="{$rs[title]}">{sdcms.cutstr($rs[title],70,1)}</a>
{/sdcms:rs}</div>

[backcolor=rgba(255, 255, 255, 0.9)]==============================
================标签详解======
==============================
[backcolor=rgba(255, 255, 255, 0.9)]{classname} 当前栏目名字
{classid} 当前栏目id(单页模型)
{cateid} 当前栏目id(其他模型)
{followid} 当前内容所属栏目的父栏目ID
{sonid}        当前内容所属栏目的所有子类
{parentid} 当前内容所属栏目的所有父类
{catepic} 当前内容所属栏目的图片Url
{id} 当前内容的ID
{title} 当前内容的标题
{seokey} 当前内容的Seo关键字
{seodesc} 当前内容的Seo描述
{intro} 内容简介
{content} 显示内容
{get_content_page} 当内容有分页时显示分页链接
{contenturl} 当前内容的url
{page} 如果有内容分页,可以显示当前页数
{author} 作者
{comefrom} 来源
{createdate} 发布日期
{lastupdate} 更新日期
{hits} 人气
{style} 标题修饰CSS
{pic} 缩略图
{ispic} 是否有缩略图,可选值:0和1,为1时表示有缩略图
{tags} 内容的标签,要显示出来,请参考默认模板方法
{url} 外链网址
{isurl} 是否为外链,可选值:0和1,为1时表示为外链
{islock} 内容的状态
{isnice} 是否为推荐内容,为1时表示推荐
{ontop} 是否为置顶内容,为1时表示置顶
{iscomment} 是否允许评论,为1时表示允许
{comments} 评论数量
{likeid} 相关内容的ID,为0时表示没有相关内容
{point} 阅读积分收费积分数
[backcolor=rgba(255, 255, 255, 0.9)]
下面是内容模型中的调用方法
标签形式:{rsshow[字段名]}
[backcolor=rgba(255, 255, 255, 0.9)]将内容副表的字段名替换为上面的即可,比如表“sd_model_down”中有如下字段,version和softsize,那么我们要调用的话,这样就可以了:
{rsshow[version]}和{rsshow[softsize]}


[backcolor=rgba(255, 255, 255, 0.9)]==============================
================手机模板======
==============================
手机模板(在pc模板加入下2行代码,自动识别移动设备)
<script>var webroot="{webroot}";</script>
<script src="{webroot}lib/js/mobile.js"></script>

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

专注素材教程免费分享
全国免费QQ热线

1586680266

周一至周日9:00-23:00

反馈建议

1586680266@qq.com 在线QQ咨询

扫描二维码关注我们

Powered by 资源门户网© 2020-2021 bbs.menhuye.com