1、標(biāo)題、關(guān)鍵詞、描述 和 網(wǎng)站系統(tǒng)設(shè)置標(biāo)簽[top]
網(wǎng)站系統(tǒng)標(biāo)簽:
{webroot}作用:系統(tǒng)路徑
{weburl}作用:網(wǎng)站URL
{sdcms[webcount]}作用:網(wǎng)站第三方流量統(tǒng)計代碼
{sdcms[webicp]}作用:網(wǎng)站備案號
{sdcms[webname]}作用:顯示網(wǎng)站名稱
{sdcms[seotitle]}作用:顯示優(yōu)化標(biāo)題
{sdcms[seokey]}作用:網(wǎng)站SEO關(guān)鍵字
{sdcms[seodesc]}作用:網(wǎng)站SEO描述
{webmode}作用:系統(tǒng)運(yùn)行模式(數(shù)值:1為動態(tài),2為偽靜態(tài),3為靜態(tài))
{htmldir}作用:靜態(tài)模式下,生成文件目錄
備注:sd_config表中的任意行數(shù)據(jù)均可通過下面的方式調(diào)用
舉例,我們要調(diào)用表setkey字段值為”agreement”的setvalue的內(nèi)容時,只需要這樣書寫即可
{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)}”/>
內(nèi)容頁:
<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}
導(dǎo)航:
<li><a href=”{webroot}”>網(wǎng)站首頁</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}
調(diào)用單頁:
——–【任意頁面】調(diào)用單頁簡介———
{sdcms:rs table=”sd_model_page” where=”classid=1″}
{sdcms.dehtml($rs[intro])}
{/sdcms:rs}
——–【單頁專用】調(diào)用單頁內(nèi)容———
{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.常用公共函數(shù),標(biāo)簽[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}
判斷如果有圖片,輸出圖片地址,沒有就用默認(rèn)的圖片
日期輸出:
{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循環(huán):
{dim wayarr:wayarr=split($rs[downway],”,”)}
{for i=0 to ubound(wayarr)}
<li><a href=”” >{wayarr(i)}</a></li>
{/for}
這個是以下載地址為例,獲取下載地址的個數(shù),逐個輸出
【內(nèi)容頁】輸出tag
{for i=0 to ubound(tags)}<a href=”{webroot}plug/tags.asp?tag={server.urlencode(tags(i))}”>{tags(i)}</a> {/for}
【任意頁面】查詢一個內(nèi)容時輸出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}
【任意頁面】查詢多個內(nèi)容時輸出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語句:
如何在列表頁,輸出自定義字段的內(nèi)容!
(以文章模型news為例)
第一步在{sdcms:rs …… }中加入以下字段:
join=”left join sd_model_news on sd_content.id=sd_model_news.cid”
第二步在field參數(shù)里加上你要調(diào)用的字段
第三步{$rs[字段名]}
3.RS查詢語句[rs]
內(nèi)容查詢:
{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)])】–某個欄目及其下屬所有欄目下的內(nèi)容
【islock=1】– 已通過審核的內(nèi)容
【isnice=1】– 推薦的內(nèi)容,【ispic=1】– 帶縮略圖的內(nèi)容
欄目查詢:
{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】 –(欄目頁)當(dāng)前大類的二級欄目
【cateid in ([sonid]) or cateid in ([parentid])】 –(欄目頁)當(dāng)前大類及其下屬所有級分類
【followid = [followid]】 — 當(dāng)前欄目的下級欄目
【ismenu=1】– 是否是導(dǎo)航
【followid=1】欄目id為1的下屬欄目,【depth=1】一級欄目
【sonid】– 子欄目字段,【parentid】– 父欄目字段,【modeid=-1】–模型id,-1表示為單頁
join語句:
如何在列表頁,輸出自定義字段的內(nèi)容?。ㄒ晕恼履P蚽ews為例)
第一步在{sdcms:rs …… }中加入以下字段:
join=”left join sd_model_news on sd_content.id=sd_model_news.cid”
第二步在field參數(shù)里加上你要調(diào)用的字段
第三步{$rs[字段名]}
排序:
【內(nèi)容排序】
order=”ontop desc,id desc,lastupdate desc,createdate desc”
【欄目排序】
order=”ordnum,cateid”
模型查詢:
<!–產(chǎn)品開始–>
{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)}
<!–下面再查詢欄目或內(nèi)容–>
{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}
<!–產(chǎn)品結(jié)束–>
隨機(jī):
【隨機(jī)查詢】
其他都一樣
order=”rnd”
【內(nèi)容分頁】
pagesize=”{var pagenum}”
【自定義參數(shù),參數(shù)從1+,最大值為rs結(jié)果集個數(shù)】
auto=”i”
4.列表頁[list]
常用標(biāo)簽:
欄目名稱 {classname} 欄目關(guān)鍵字 {seokey}
欄目描述 {seodesc} 優(yōu)化標(biāo)題 {seotitle}
欄目ID {classid} 欄目所有父ID {parentid}
分頁數(shù)量 {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}
———–經(jīng)典案例——–
查詢?nèi)慨?dāng)前分類: where=”cateid in ([parentid]) or followid in ([parentid])”
查詢當(dāng)前下級分類: where=”followid in ([parentid])”
查詢當(dāng)前分類(除了一級分類):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>
查詢內(nèi)容
{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>
———–下面是單頁內(nèi)容輸出————
{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.內(nèi)容頁[content]
常用標(biāo)簽:
所屬欄目名稱 {classname} 更新日期 {lastupdate}
標(biāo)題 {title} 內(nèi)容簡介 {intro}
顯示內(nèi)容 {content} 縮略圖 {pic}
作者 {author} 內(nèi)容分頁 {get_content_page}
內(nèi)容url {contenturl} 人氣 {hits}
標(biāo)題CSS {style} 相關(guān)內(nèi)容id {likeid}
不常用標(biāo)簽:
是否帶圖 {ispic} 內(nèi)容的標(biāo)簽 {tags}
所屬欄目ID {classid} 發(fā)布日期 {createdate}
所屬父欄目ID {followid} 所屬欄目的所有子類 {sonid}
所屬欄目圖片 {catepic} 所屬欄目的所有父類 {parentid}
當(dāng)前內(nèi)容ID {id} 內(nèi)容分頁的當(dāng)前頁數(shù) {page}
外鏈網(wǎng)址 {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}上一篇:沒有了{(lán)/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}下一篇:沒有了{(lán)/rs:eof}
下一篇:<a href=”{$rs[link]}”>{sdcms.cutstr($rs[title],90,1)}</a>
{/sdcms:rs}
查內(nèi)容
{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>
【內(nèi)容頁】輸出tag
{for i=0 to ubound(tags)}<a href=”{webroot}plug/tags.asp?tag={server.urlencode(tags(i))}”>{tags(i)}</a> {/for}
11.制作幻燈片模塊【banner】
步驟
第一種方法:【推薦】
在后臺擴(kuò)展》廣告處,添加一個廣告分類;
然后添加圖片廣告,添加的時候選擇對應(yīng)的分類
然后記下該分類的id,使用廣告代碼調(diào)取
第二種方法:
在后臺欄目處,添加一個外鏈接作為一級欄目;
在此欄目下,添加子欄目作為幻燈片圖片,上傳圖片
記下該一級欄目的id,調(diào)用圖片的時候使用
查詢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}
==========內(nèi)頁banner======
{if catepic=””}默認(rèn)圖片{else}{catepic}{/if}
廣告調(diào)取【推薦】
{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}
查詢擴(kuò)展分類名稱
{sdcms:rs top=”1″ field=”classname” table=”sd_expand_class” where=”classid=1″}
分類名稱:{$rs[classname]}
{/sdcms:rs}
調(diào)用某個類別的名稱、url、某個內(nèi)容的url
1.類別名稱{sdcms.getcatename(1)}
2.類別的Url{sdcms.getcateurl(1)}
3.帶超鏈接的類別名稱{sdcms.getcateinfo(1)}
4.單獨調(diào)用某個內(nèi)容的URL,其中1為內(nèi)容的ID{sdcms.getcontenturl(1)}
5.獲取當(dāng)前欄目及其所有子欄目id{sdcms.get_sonid(1)}
6.過濾掉html代碼,并再次截取前90個數(shù)字
{sdcms.cutstr(sdcms.nohtml($rs[intro]),90,1)}
當(dāng)前位置:{sdcms.getpostion(parentid,” > “)}
內(nèi)容簡介:{sdcms.cutstr(sdcms.nohtml($rs[intro]),90,1)}
自定義字段調(diào)?。簕rsshow[字段名]}