DEDECMS常用標簽技巧匯總_DedeCms教程

      編輯Tag賺U幣
      教程Tag:暫無Tag,歡迎添加,賺取U幣!
      1  DEDE的使用最多的標簽技巧詳解

      {dede:arclist typeid='' row='' col='' titlelen='' infolen=''
      imgwidth='' imgheight='' listtype='' orderby='' keyword=''}

      去除html
      [field:title function='htmlspecialchars(@me)'/]
      主要使用在FLASH以及<a>中,是了了去除標簽中的HTML元素,比如<b></b>等,如果不使用此標簽,則會導致HTML代碼顯示在頁面中。
      使用方法


      <a title="[field:title function='htmlspecialchars(@me)'/] " href="[field:arcurl /]">[field:title /]</a>

      或者

      <a href="[field:arcurl /]" ><img src='[field:litpic/]' alt="[field:title function='htmlspecialchars(@me)'/]" border='0' width='' height=''></a>


      圖片:
      1: <a href='[field:arcurl /]'><img src='[field:litpic/]' border='0' width='' height=''></a>

      2: [field:imglink /]

      3 :<a href='[field:arcurl /]'>
      [field:image/]</a>



      [field:imglink /]與<a href='[field:arcurl /]'>[field:image/]</a> 是完全等價的,只不過后者更靈活一點,可以在 <a>中添加 title=""



      <a href='[field:arcurl /]' title="[field:title function='htmlspecialchars(@me)'/] ">[field:image/]</a>

      <a href='[field:arcurl /]'><img src='[field:litpic/]' border='0' width='' height=''></a>

      則更為靈活,不僅可以添加title="",還可以添加 alt="",但是雖然靈活了,缺少了圖片的寬度和高度的控制,所以要在CSS中控制圖片的大小,適合對CSS有一點了解的人。


      攔目:
      1:<a href='[field:typeurl /]'>[field:typename /]</a>

      2:[field:typelink /]
        
        


      二者是相等的,只不過是前者更靈活一點
      連接:
      1: <a href='[field:arcurl /]'>[field:title /]</a>

      2:[field:textlink /]


      兩者是相等的,前者比后者更靈活,可以增加titie=""
      在這里應該注意的是,title長度的問題,Dedecms數據庫中最大長度為80字節,40漢字寬度,另外,arclist標簽里面如果不設置titlelen的值,則默認取值為30字符,15漢字寬度
      所以除了在使用titlelen控制標題長度,還可以使用另外一種方法來控制標題長度
      設置titlelen="80"


      <a href="[field:arcurl /]" title="[field:title function='htmlspecialchars(@me)'/]">[field:title function="cn_substr(@me,40)"/]</a>

      這種格式的好處是,title=""中為完整標題,即鼠標停留顯示完整標題,function="cn_substr(@me,40)"作用是截取40字符寬度,20漢寬度。


      點擊:
      [field:click/]

      [field:click runphp="yes"]
      if(@me>1000)@me='<font color="#ff0000">@me</font>';
      else @me=@me;
      [/field:click]


      超過1000點擊的,顯示紅色


      簡介:

      1:[field:info /]

      2:[field:description /]

      3:[field:info function="cn_substr(@me,120)"/]

      4:[field:description function="cn_substr(@me,120)"/]


      兩種是相等的,簡介長度有兩種控制方式,一種是infolen="" 控制,如果infolen無參數,則默認為250
      另外一種是使用function="cn_substr(@me,120)"控制
      120為所取字符寬度,

      日期:
      [field:pubdate /]

      效果
      1:


      [attachment=19281]  

      [field:pubdate runphp="yes"]  
      if((time()-@me)<(60*60*24)){@me=' <font color="#ff6600">'.strftime("%H:%M",@me).'</FONT>';}  
      else {@me=strftime("%m-%d",@me);}  
      [/field:pubdate]


      效果 2:

      24內發布的文章日期顯示紅色

      [field:pubdate runphp="yes"]  
      if((time()-@me)<(60*60*24)){@me=' <font color="#ff6600">'.strftime("%m-%d",@me).'</FONT>';}  
      else {@me=strftime("%m-%d",@me);}  
      [/field:pubdate]
                
                      

      [field:pubdate function='strftime("%Y-%m-%d %H:%M:%S",@me)'/]
      2008-11-01 11:11:52
      [field:pubdate function='strftime("%y-%m-%d %H:%M:%S",@me)'/]
      08-11-01 11:11:52
      [field:pubdate function='strftime("%m-%d %H:%M:%S",@me)'/]
      11-01 11:14:20
      [field:pubdate function='strftime("%m-%d %H:%M",@me)'/]
      11-01 11:14
      [field:pubdate function='strftime("%y-%m-%d",@me)'/]
      08-11-01
      [field:pubdate function='strftime("%y年%m月%d日",@me)'/]
      08年11月01日
      [field:pubdate function='strftime("%Y年%m月%d日 %H點%M分%S秒",@me)'/]
      2008年11月01日 11點17分36秒
      [field:pubdate function='strftime("%b %d, %Y",@me)'/]
      Nov 01, 2008
      [field:pubdate function='strftime("%A on %b %d, %Y, %X : %Z",@me)'/]
      Saturday on Nov 01, 2008, 11:21:06 : 中國標準時間




      • %a 星期幾的縮寫。
      • %A 星期幾的全名。
      • %b 月份名稱的縮寫。
      • %B 月份名稱的全名。
      • %c 本地端日期時間較佳表示字符串。
      • %d 用數字表示本月的第幾天 (范圍為 00 至 31)。
      • %H 用 24 小時制數字表示小時數 (范圍為 00 至 23)。
      • %I 用 12 小時制數字表示小時數 (范圍為 01 至 12)。
      • %j 以數字表示當年度的第幾天 (范圍為 001 至 366)。
      • %m 月份的數字 (范圍由 1 至 12)。
      • %M 分鐘。
      • %p 以 'AM' 或 'PM' 表示本地端時間。
      • %S 秒數。
      • %U 數字表示為本年度的第幾周,第一個星期由第一個周日開始。
      • %W 數字表示為本年度的第幾周,第一個星期由第一個周一開始。
      • %w 用數字表示本周的第幾天 ( 0 為周日)。
      • %x 不含時間的日期表示法。
      • %X 不含日期的時間表示法。
      • %y 二位數字表示年份 (范圍由 00 至 99)。
      • %Y 完整的年份數字表示,即四位數。
      • %Z 時區或名稱縮寫。
      • %% % 字符。
      評論:
      [field:postnum/]

      作者:

      [field:writer /]
       


      {/dede:arclist}    
      1:排列LI

         <li><a class="" href="" target="_blank">[欄目]</a> <a  class="" href="" title="挑剔">標題</a></li>

      運行代碼 源代碼調試 [www.wf0088.com]

          [ 可先修改部分代碼 再運行查看效果 ]


      PS:隔行不同色為背景圖

      2

      運行代碼 源代碼調試 [www.wf0088.com]

         

      查看更多 DedeCms教程  織夢模板  織夢DedeCms視頻教程  織夢dedecms專題

      來源:DedeCms官方論壇//所屬分類:DedeCms教程/更新時間:2009-04-21
      相關DedeCms教程