dedecms仿站必知標簽調用集,織夢文章
導讀:織夢文章織夢文章——————————————————————————–列表頁調用TAG標簽的兩種方法dedecms默認在列表是無法調用tag標簽的,經過各位版主們的幫助,現給大dede后臺模板dede,模板。
——————————————————————————– 列表頁調用TAG標簽的兩種方法 dedecms默認在列表是無法調用tag標簽的,經過各位版主們的幫助,現給大家提供出種方法 方法1: 在列表需要的位置加入下列代碼 [field:id runphp=yes] $tsql = new DedeSql(false); $tags = ”; $tsql->SetQuery(“Select i.tagname From dede_tag_list t left join dede_tag_index i on i.id=t.tid where t.aid=’@me’“); $tsql->Execute(‘t’); while($row = $tsql->GetArray(‘t’,MYSQL_ASSOC)){ $tags .= “<a href=’/tag.php?/”.urlencode($row['tagname']).”‘>”.$row['tagname'].”</a>”; } @me=$tags; [/field:id] 方法2: 在inc_functions.php文件里加入 function listtag($aid){ $tsql = new DedeSql(false); $tags = ”; $tsql->SetQuery(“Select i.tagname From dede_tag_list t left join dede_tag_index i on i.id=t.tid where t.aid=’$aid’”); $tsql->Execute(‘t’); while($row = $tsql->GetArray(‘t’,MYSQL_ASSOC)){ $tags .= “<a href=’/tag.php?/”.urlencode($row['tagname']).”‘>”.$row['tagname'].”</a>”; } return $tags; } 然后在列表頁相應位置加入 [field:ID function="listtag(@me)"/]標記 ——————————————————————————– {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′ widt織夢首頁模板h=” height=”></a> 2: [field:imglink /] 3: <a href=’[field:arcurl /]‘> [field:image/]</a> [field:imglink /]與<a href=’[field:arcurl /]‘>[field:imag織夢的模板e/]</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:textl織夢模板ink /] 兩者是相等的,前者比后者更靈活,可以增加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:[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)。
聲明: 本文由我的SEOUC技術文章主頁發布于:2023-07-21 ,文章dedecms仿站必知標簽調用集,織夢文章主要講述標簽,標題,織夢網站建設源碼以及服務器配置搭建相關技術文章。轉載請保留鏈接: http://www.bifwcx.com/article/web_33484.html