文字

SDCMS标签-首页模板

首页常用标签

模版引用

<%if not in_sdcms then response.write("template load fail"):response.end() end if%>

模版文件路径引用

<script src="{webroot}theme/default/js/sdcms.js"></script>

动态文件引用

{sdcms:include("sdcms_head.asp")}

标题、关键词、描述 

<title>{sdcms[webname]}{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}" /> 
<script>var webroot="{webroot}";</script>
<script src="{webroot}lib/js/jquery.js"></script>
{if sdcms[sys_mobile]}<script src="{webroot}lib/js/mobile.js"></script>{/if}

例:推荐带图新闻

{sdcms:rs top="5" field="id,title,style,createdate,isurl,url,classid,pic,intro" table="sd_content" where="islock=1 and ispic=1 and isnice=1" order="ontop desc,id desc"}
{rs:eof}
<li>
  <div class="pic"> <img src="{webroot}theme/default/pic/f01.jpg" width="300" height="210" />
    <div class="title">无图片新闻标题</div>
    <div class="intro">无图片内容简介</div>
  </div>
</li>
{/rs:eof}
<li>
  <div class="pic"> <a href="{$rs[link]}" title="{$rs[title]}"><img src="{$rs[pic]}" width="300" height="210" alt="{$rs[title]}" /></a>
    <div class="title">{sdcms.cutstr($rs[title],30,1)}</div>
    <div class="intro">{sdcms.cutstr(sdcms.nohtml($rs[intro]),90,1)}</div>
  </div>
</li>
{/sdcms:rs}

例:循环所有列表栏目、内容

{sdcms:rp table="sd_category" top="6" where="followid=0 and modeid>0" order="ordnum,cateid" var="sdcms_dim:sonid" auto="j"}
            <div class="block b">
                <div class="subject"><span><a href="{$rp[link]}">更多>></a></span><a href="{$rp[link]}">{$rp[catename]}</a></div>
                {dim tid:tid=0}
                {sdcms:rs top="1" field="id,title,style,createdate,isurl,url,classid,pic,intro" table="sd_content" where="islock=1 and classid in([sdcms_dim]) and ispic=1 and isnice=1" order="ontop desc,id desc"}<div class="toppic"><img src="{$rs[pic]}" width="100" height="70" /><a href="{$rs[link]}" title="{$rs[title]}"{if $rs[isurl]=1} target="_blank"{/if}>{sdcms.cutstr($rs[title],20,1)}</a>{sdcms.cutstr(sdcms.nohtml($rs[intro]),54,1)}</div><%tid=$rs[id]%>{/sdcms:rs}
                <ul class="topnew">
                {sdcms:rs top="8" field="id,title,style,createdate,isurl,url,classid" table="sd_content" where="islock=1 and classid in([sdcms_dim]) and id<>[tid]" 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],30,1)}</a></li>
                {/sdcms:rs}    
                </ul>
            </div>
            {/sdcms:rp}

例:产品展示

{sdcms:rs top="8" table="sd_model_pro" join="left join sd_content on sd_model_pro.cid=sd_content.id"  where="islock=1 and isnice=1" order="ontop desc,id desc"}
            <li><a href="{$rs[link]}" title="{$rs[title]}"><img src="{if $rs[ispic]=1}{$rs[pic]}{else}{webroot}theme/default/images/nopic_pro.gif{/if}" alt="{$rs[title]}" width="208" height="208" border="0" /><div class="title">{sdcms.cutstr($rs[title],20,0)}</div><div class="more">查看更多</div></a></li>
            {/sdcms:rs}

例:新闻资讯

{sdcms:rs top="4" table="sd_model_news" join="left join sd_content on sd_model_news.cid=sd_content.id"  where="islock=1" order="ontop desc,id desc"}
   <li><a href="{$rs[link]}" title="{$rs[title]}"><img src="{if $rs[ispic]=1}{$rs[pic]}{else}{webroot}theme/default/images/nopic_news.gif{/if}" alt="{$rs[title]}" width="160" height="100" border="0" /><div class="title">{sdcms.cutstr($rs[title],30,0)}</div><div class="date">{sdcms.getdate($rs[createdate],"-",1)}</div><div class="intro">{sdcms.cutstr(sdcms.nohtml($rs[intro]),110,1)}</div></a></li>
{/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}
 <li><a href="{$rs[weburl]}" target="_blank"><img src="{$rs[weblogo]}" width="88" height="31" border="0" alt="{$rs[webname]}" /></a></li>
 {/sdcms:rs}