sdcms标签
模板防盜:<%if not in_sdcms then response.write("template load fail"):response.end() end if%>
--------------
seo標題:
{sdcms[webname]}{sdcms[seotitle]}
seo關鍵詞:
{seokey}
seo描述:
{seodesc}
--------------
文件路徑例如:images路徑:{webroot}theme/default/images/
?
--------------
模板引用:
{sdcms:include("sdcms_head.asp")}
{sdcms:include("sdcms_foot.asp")}
--------------
獲取單個欄目:
{sdcms.getcateurl(1)} 獲得欄目1的鏈接
{sdcms.getcatename(1)} 欄目名稱
--------------
?
1.首頁調用單頁簡介的方法為:
{sdcms:rs table="sd_model_page" where="classid=1"}
{sdcms.dehtml($rs[intro])}
{/sdcms:rs}
2.首頁調用單頁內容的方法為:
{sdcms:rs table="sd_model_page" where="classid=1"}
{$rs[content]}
{/sdcms:rs}
--------------
調用幾條內容
{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)}
時間格式
{sdcms.getdate($rs[createdate],"-",1)}
?
調取自定義字段的方法:
{sdcms:rs table="sd_content" top="20" where="classid=12" var="sdcms_dim:id" auto="j"} ?//var="sdcms_dim:id"定義一個值,作為傳給下個循環的條件
? ?{sdcms:rp table="sd_model_news" top="20" where="cid=[sdcms_dim]"} //sd_model_news 不同模型表不一樣
{$rp[新增的字段]}
{/sdcms:rp}
{/sdcms:rs}
?
--------------
獲取一某個欄目的所有子欄目: {dim dim_sonid:dim_sonid=sdcms.get_sonid("15")}
調用幾個欄目
{sdcms:rs table="sd_category" top="10" where="ismenu=1" order="ordnum"}
<li><a href="{$rs[link]}">{$rs[catename]}</a></li>
{/sdcms:rs}
?
多級欄目:
{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}
?
頭部欄目nav模板:
{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}
?
?
內頁冊欄目:通用萬能調用方法
{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}
------------------------
判斷是否有子欄目
{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}
?
?
欄目高亮判斷條件:{if $rs[cateid]=[classid] or $rs[cateid]=[followid]} class="cur"{/if}
?
--------------
友情鏈接
{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
--------------
if判斷格式
{if i mod 5=0}<li class="mid"></li>{/if}
?
--------------
前欄目名字
您所在的位置:<a href="{webroot}">首頁</a>{sdcms.getpostion(parentid," > ")}
--------------
單篇調用內容 方法
{sdcms:rs table="sd_model_page" top="1" where="classid=[classid]"}
{sdcms.get_content_split($rs[content],htmlrule)}
{/sdcms:rs}
詳情頁 專用
{title} 標題
作者:{author} 來源:{comefrom} 日期:{createdate}
{content} 內容
調取自定義字段
{rsshow[字段名]}
?
?
<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>
?
<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>
?
==============================
================標簽詳解======
==============================
{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} 閱讀積分收費積分數
下面是內容模型中的調用方法
標簽形式:{rsshow[字段名]}
將內容副表的字段名替換為上面的即可,比如表“sd_model_down”中有如下字段,version和softsize,那么我們要調用的話,這樣就可以了:
{rsshow[version]}和{rsshow[softsize]}
?
?
==============================
================手機模板======
==============================
手機模板(在pc模板加入下2行代碼,自動識別移動設備)
<script>var webroot="{webroot}";</script>
<script src="{webroot}lib/js/mobile.js"></script>
轉載于:https://www.cnblogs.com/masterccc/p/5249985.html
總結
- 上一篇: windows10下安装Linux7,W
- 下一篇: js调用pc摄像头实现拍照、录视频等,新