久久精品水蜜桃av综合天堂,久久精品丝袜高跟鞋,精品国产肉丝袜久久,国产一区二区三区色噜噜,黑人video粗暴亚裔

YulinCMS ContList標(biāo)簽調(diào)用示例

來(lái)自站長(zhǎng)百科
跳轉(zhuǎn)至: 導(dǎo)航、? 搜索

導(dǎo)航: 上一頁(yè)

ContList是最常用的模板標(biāo)簽,主要用于獲取數(shù)據(jù)庫(kù)中的文檔(內(nèi)容),并且以列表方式呈現(xiàn)。

下面給出的例子一步一步、由簡(jiǎn)到繁。

ContList 模板標(biāo)簽書(shū)寫(xiě)格式為如下:

{Yu:ContList 屬性1="屬性值1" 屬性2="屬性值2"}
{NormalTemplate}  普通項(xiàng)模板+底層變量.......{/NormalTemplate}
{AlterTemplate}  交替項(xiàng)模板+底層變量........{/AlterTemplate}
SeparTemplate}  分隔符模板.................{/SeparTemplate}
{ConditionTemplate}  條件輸出模板...........{/ConditionTemplate}
{/Yu:ContList}

簡(jiǎn)單的文檔列表[ ]

{Yu:ContList Count="10" Sort="AddTime" Order="DESC"}
<a href="{@ContPath/}" target="_blank">{@Title/}</a><br/>
{/Yu:ContList}
YulinCMS ContListTags1.gif
  • 標(biāo)簽解釋

獲取最新的10篇文檔,顯示帶超鏈接的標(biāo)題

  • 其它說(shuō)明

標(biāo)簽屬性 Count="10" 表示取10篇文檔。 Sort="AddTime" Order="DESC" 這個(gè)兩個(gè)屬性一起表示按時(shí)間降序排序。

變量 {@ContPath/} 表示文檔路徑,{@Title/} 是文檔標(biāo)題。

因?yàn)橄到y(tǒng)默認(rèn)該標(biāo)簽屬性 Count="10" Sort="AddTime" Order="DESC" 所以上面標(biāo)簽也可以簡(jiǎn)寫(xiě)成:

{Yu:ContList}<a href="{@ContPath/}">{@Title/}</a>
{/Yu:ContList}

帶欄目標(biāo)題文檔列表[ ]

<table width="360" cellpadding="0" cellspacing="0">
{Yu:ContList Count="10" TitleLen="30" TitleAddStr="..."}
<tr>
<td>
<span style="color:#999">[{@CateTitle/}]</span>
<a href="{@ContPath/}" title="{@FullTitle/}" target="_blank">{@Title/}</a>
</td>
<td width="80" >
<span style="color:#999">{@AddTime F="FormatTime(yyyy-MM-dd)"/}</span>
</td>
</tr>
{/Yu:ContList}
</table>
YulinCMS ContListTags2.gif
  • 標(biāo)簽解釋

獲取最新10篇文檔,顯示帶超鏈接的標(biāo)題、所屬欄目的標(biāo)題、文檔發(fā)布時(shí)間。如果標(biāo)題長(zhǎng)度超過(guò)30個(gè)字符寬,后面的部分將被截去用...替換。

  • 其它說(shuō)明

{@AddTime/} 是文檔發(fā)布時(shí)間,默認(rèn)情況下會(huì)以yyyy-MM-dd HH:mm:ss 形式顯示。例如:2009-3-10 10:27:58 。

為了只顯示日期部分,可以用時(shí)間格式化函數(shù)來(lái)處理,例如上面示例中的 {@AddTime F="FormatTime(yyyy-MM-dd)"/} 。

{@Title/} 和 {@FullTitle/} 都指的是文檔標(biāo)題。但是{@FullTitle/}不會(huì)被截去字符,顯示的是完整的標(biāo)題,通常用作鼠標(biāo)提示完整標(biāo)題。

按閱讀排序的文檔列表[ ]

<table width="350" cellpadding="0" cellspacing="0">
{Yu:ContList Cate="46" Count="10" Sort="ClickTotal" Order="DESC" LastDay="60" TitleLen="30" TitleAddStr="..."}
<tr>
<td>
<img src="{$$SkinPath}/Images/dot.gif" border="0" align="absmiddle"/> <a href="{@ContPath/}" title="{@FullTitle/}" target="_blank">
{@Title/}</a>
</td>
<td width="80" >
<span style="color:#999">閱讀:{@ClickTotal/}</span>
</td>
</tr>
{/Yu:ContList}
</table>
YulinCMS ContListTags3.gif
  • 標(biāo)簽解釋

獲取編號(hào)為46的欄目下、最近60天以來(lái)瀏覽最多的10篇文檔,顯示標(biāo)題、文檔閱讀次數(shù)。如果標(biāo)題長(zhǎng)度超過(guò)30個(gè)字符寬,后面的部分將被截去用...替換。

  • 其它說(shuō)明

標(biāo)簽屬性 Sort="ClickTotal" Order="DESC" 一起表示閱讀次數(shù)降序排序。

同理也可以將標(biāo)簽屬性Sort改為 Sort="CommTotal" 則可以按評(píng)論數(shù)降序排序。

標(biāo)簽屬性TitleLen 指定標(biāo)題顯示長(zhǎng)度,超過(guò)則截去,并且用TitleAddStr的值來(lái)替代。 不指定該屬性 則顯示完整標(biāo)題。

在底層模板中也可以使用公共變量 ,例如上面例子中 {$$SkinPath/} 用來(lái)獲取當(dāng)前模版風(fēng)格的皮膚存放路徑。

多列顯示文檔列表[ ]

{Yu:ContList Cate="46" Count="10" Cols="2" TableStyle="cellpadding=\"0\" cellspacing=\"0\" width=\"600\" " tdStyle=" align=\"center\" "}
<a href="{@ContPath/}">{@Title/}</a>
{/Yu:ContList}
YulinCMS ContListTags4.gif
  • 標(biāo)簽解釋

獲取編號(hào)為46的欄目下最近的10篇文檔,按照2列顯示帶超鏈接的標(biāo)題

  • 其它說(shuō)明

該標(biāo)簽屬性Cols 是關(guān)鍵,指定多少就按多少列顯示內(nèi)容。系統(tǒng)是用HTML

元素來(lái)呈現(xiàn)的多列效果的。

tableStyle、trStyle、tdStyle 這三個(gè)標(biāo)簽屬性都是配合Cols顯示的。

tableStyle可用來(lái)指定HTML元素的樣式,trStyle用來(lái)指定HTML元素的樣式,tdStyle用來(lái)指定HTML元素
的樣式。也可以不使用它們。

這里說(shuō)明一點(diǎn),標(biāo)簽屬性值如果包含引號(hào) " ' 則必須在前面加上斜杠。如 \" \'

交替顯示文檔列表[ ]

<table width="350" border="0" cellspacing="1" cellpadding="2" bgcolor="#e0e0e0" >
{Yu:ContList Count="10" Cate="46" Sort="AddTime" Order="DESC"}
{NormalTemplate}
<tr bgcolor="#F9F9F9">
<td><a href="{@ContPath/}">{@Title/}</a></td>
</tr>
{/NormalTemplate}
{AlterTemplate}
<tr bgcolor="#D9D9FF">
<td><a href="{@ContPath/}">{@Title/}</a></td>
</tr>
{/AlterTemplate}
{/Yu:ContList}
</table>
YulinCMS ContListTags5.gif
  • 標(biāo)簽解釋

獲取編號(hào)為46的欄目下最近的10篇文檔,顯示其標(biāo)題,并且標(biāo)題背景顏色交替變換。

  • 其它說(shuō)明

{NormalTemplate}...{/NormalTemplate}之間是普通項(xiàng)模板元素的內(nèi)容,{AlterTemplate}...{/AlterTemplate} 之間是交替項(xiàng)模板元素的內(nèi)容

帶分割線的文檔列表[ ]

{Yu:ContList Cate="46" Count="15" Sort="AddTime" Order="DESC" Condition="5"}
{NormalTemplate}
<a href="{@ContPath/}" target="_blank">{@Title/}</a> <span style="color:#999">{@AddTime F="FormatTime(yyyy-MM-dd)"/}<br/>
{/NormalTemplate}
{ConditionTemplate}
<hr style="border:1px #ccc solid"/>
{/ConditionTemplate}
{/Yu:ContList}
YulinCMS ContListTags6.gif
  • 標(biāo)簽解釋

獲取編號(hào)為46的欄目下最近的15篇文檔,每顯示5篇加一條分割線。

  • 其它說(shuō)明

{ConditionTemplate}...{/ConsitionTemplate} 之間是條件輸出模板元素的內(nèi)容,與屬性 Condition 配合使用。

例如:上面例子中屬性 Condition="5" 表示當(dāng)文檔數(shù)量達(dá)到 5 的倍數(shù)時(shí),就輸出模板元素 ConditionTemplate 中的內(nèi)容。

帶縮略圖的文檔列表[ ]

<table width="300" border="0" cellspacing="0" cellpadding="0" >
{Yu:ContList Count="3" Where="TitlePicture" TitleLen="30" TitleAddStr="..."}
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td align="center"><a href="{@ContPath/}" target="_blank"><img src="{@SPicPath_2/}" border="0" alt="{@FullTitle/}"/></a></td>
</tr>
<tr>
<td align="center"><a href="{@ContPath/}" target="blank" title="{@FullTitle/}"/>{@Title/}</a></td>
</tr>
</table>
</td>
</tr>
{/Yu:ContList}
</table>
YulinCMS ContListTags7.gif
  • 標(biāo)簽解釋

獲取最近的3篇 帶標(biāo)題圖片的文檔,顯示其標(biāo)題縮略圖、標(biāo)題文字。

  • 其它說(shuō)明

{@PicPath/} 是文檔的 原始標(biāo)題圖片。

系統(tǒng)根據(jù) 原始標(biāo)題圖片 自動(dòng)生成了三種規(guī)格的縮略圖,分別為 {@SPicPath_1/}(尺寸 300*200) {@SPicPath_2/}(尺寸 150*100) {@SPicPath_3/}(尺寸 90 * 60) 。

在這個(gè)例子中使用了{(lán)@SPicPath_2/}

多列顯示帶縮略圖的文檔列表[ ]

{Yu:ContList Count="9" Cols="3" Where="TitlePicture" TitleLen="30" TitleAddStr="..."}
<table width="100%" border="0" cellspacing="1" cellpadding="2" >
<tr><td align="center"><a href="{@ContPath/}" target="_blank"><img src="{@SPicPath_2/}" border="0" alt="{@FullTitle/}"/></a></td></tr>
<tr><td align="center"><a href="{@ContPath/}" target="_blank" title="{@FullTitle/}"/>{@Title/}</a></td></tr>
</table>
{/Yu:ContList}
YulinCMS ContListTags8.gif
  • 標(biāo)簽解釋

獲取最近的 9 篇帶標(biāo)題圖片的文檔,按 3 列顯示其標(biāo)題縮略圖、標(biāo)題文字。

帶縮略圖和摘要的文檔列表[ ]

<table border="0" cellspacing="0" cellpadding="0" >
{Yu:ContList Count="4" Where="TitlePicture&Depict" DepictLen="110" DepictAddStr="..."}
<tr><td>
<table width="400" border="0" cellspacing="0" cellpadding="2">
<tr><td><a href="{@ContPath/}" target="_blank"><img src="{@SPicPath_2/}" border="0" alt="{@FullTitle/}"/></a></td>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td>
<a href="{@ContPath/}" target="_blank" title="{@FullTitle/}"/><span style="text-decoration:underline;font-weight:bold">{@Title/}
</span></a></td></tr> <tr><td>{@Depict/}<a href="{@ContPath/}" target="_blank"><span style="text-decoration:underline">全文>>
</span></a> </td></tr></table></td></tr></table>
</td></tr>
{/Yu:ContList}
</table> 
YulinCMS ContListTags9.gif
  • 標(biāo)簽解釋

獲取最近的 4篇同時(shí)帶標(biāo)題圖片和摘要的文檔,顯示其標(biāo)題縮略圖、摘要、標(biāo)題文字。

  • 其它說(shuō)明

標(biāo)簽屬性 Where="TitlePicture&Depict" 意思是獲取 同時(shí)帶標(biāo)題縮略圖和摘要的文檔。

DepictLen 屬性指定標(biāo)題顯示長(zhǎng)度,超過(guò)則截去,并且用DepictAddStr的值來(lái)替代。 不指定該屬性 則顯示完整摘要。 這和屬性 TitleLen、 TitleAddStr 類似。

嵌套調(diào)用文檔列表[ ]

{Yu:CateList CateGroup="1" cols="2" tableStyle=" width=\"660\" "}
<table width="100%" cellpadding="0" cellspacing="0">
<tr><td>
<table width="100%" cellpadding="3" cellspacing="0" style="background-color:#6386C6;color:#fff;font-weight:bold;">
<tr><td>{@Title/}</td><td align="right"><a href="{@CatePath/}" target="_blank">
<span style="text-decoration:none; color:#fff;">更多 >></a></span></td></tr></table>
</td></tr>
<tr><td>
<table width="100%" cellpadding="1" cellspacing="0">
{Yu:ContList Count="6" Cate="Id" TitleLen="32" TitleAddStr="..."}<tr>
<td width="10"> · </td><td><a href="{@ContPath/}" title="{@FullTitle/}" target="_blank">
{@Title/}</a></td><td width="80" align="right">
<font color="#999999">{@AddTime F="FormatTime(yyyy-MM-dd)"/}</font></td></tr>
{/Yu:ContList}</table>
</td></tr>
</table>
{/Yu:CateList}
YulinCMS ContListTags10.gif
  • 標(biāo)簽解釋

獲取了四個(gè)欄目,并且列出每個(gè)欄目的最新6篇文檔,以2列顯示

這個(gè)例子運(yùn)用了 標(biāo)簽嵌套方式 實(shí)現(xiàn)循環(huán)顯示每個(gè)欄目下的文檔列表 。可以看到 ContList 標(biāo)簽嵌套在 CateList 標(biāo)簽的里面。

當(dāng)外層CateList標(biāo)簽循環(huán),ContList的內(nèi)容也會(huì)改變。 注意:內(nèi)層 ContList 標(biāo)簽的屬性Cate設(shè)置為 Cate="Id" 用來(lái)接收外層欄目列表的編號(hào)。

例子中的CateList標(biāo)簽的 CateGroup 屬性指的是欄目組,我們?cè)诤笈_(tái)已經(jīng)把將要展示的四個(gè)欄目放到了一個(gè)組里,只要指定屬性 CateGroup="組編號(hào)" 就調(diào)用了相應(yīng)欄目。

首頁(yè)排版欄目塊時(shí),通常要顯示每個(gè)欄目下的最新文檔列表,按照通常的做法有多少個(gè)欄目就得調(diào)用多少個(gè)ContList標(biāo)簽,現(xiàn)在用標(biāo)簽嵌套的方式,用一個(gè)標(biāo)簽就可以實(shí)現(xiàn)了。

帶附件下載的文檔列表[ ]

<table width="270" cellpadding="1" cellspacing="0">
{Yu:ContList Count="10" Cate="61" Where="TitleFile" Sort="FileDownTotal" Order="DESC"}
<tr>
<td width="20">
<a href="{@FilePath/}"><img src="{$$SkinPath/}/Images/down.gif" border="0"/></a>
</td>
<td>
<a href="{@FilePath/}" target="_blank">{@Title/}</a>
</td>
<td width="80">
<font color="#999999">下載次數(shù) {@FileDownTotal/}</font>
</td>
</tr>
{/Yu:ContList}
</table>
YulinCMS ContListTags11.gif
  • 標(biāo)簽解釋

獲取編號(hào)為61的欄目下、帶標(biāo)題附件的、并且標(biāo)題附件下載次數(shù)最多的 10篇文檔,顯示帶下載鏈接的標(biāo)題。

  • 其它說(shuō)明

標(biāo)簽屬性 Sort="FileDownTotal" Order="DESC" 一起表示 標(biāo)題附件 下載次數(shù)降序排序

{@FilePath/} 是附件下載地址 。 {@FileDownTotal/} 是附件下載次數(shù)

可分頁(yè)的文檔列表[ ]

<ul style="margin:0px;padding:0px;">
{Yu:ContList ListType="Category" Count="15"}
<li><a href="{@ContPath/}" target="_blank">{@Title/}</a> 
<span style="color:#a2a2a2">{@AddTime F="FormatTime(yyyy年MM月dd日 HH:mm)"/}</span></li>
{/Yu:ContList}
</ul>
</div>
<br/><br/>
<div>
{Yu:PageBar}
<div class="pageBar">
<div class="info">
總內(nèi)容數(shù)<span class="count">{@ContCount/}</span>
總頁(yè)數(shù)<span class="count">{@PageCount/}</span>
每頁(yè)顯示<span class="count">{@PageSize/}</span> 條內(nèi)容
</div>
<div class="plist">
<a href="{@FirstPage/}">首頁(yè)</a>
<a href="{@PrevPage/}">上一頁(yè)</a>
{@PageList/}
<a href="{@NextPage/}">下一頁(yè)</a>
<a href="{@LastPage/}">末頁(yè)</a>
</div>
{@PageSelect/}
</div>
{/Yu:PageBar}
</div> 	
YulinCMS ContListTags12.gif
  • 標(biāo)簽解釋

分頁(yè)顯示當(dāng)前欄目下的所有文檔,每頁(yè)顯示15篇, 帶一個(gè)翻頁(yè)條。

  • 其它說(shuō)明

注意ContList標(biāo)簽的屬性 ListType 它用來(lái)指定列表類型。

這個(gè)例子中的 ListType="Category" 意思是這個(gè)內(nèi)容列表僅用于欄目列表頁(yè)模板中,可實(shí)現(xiàn)分頁(yè)??芍苯邮褂肅ount屬性來(lái)指定分頁(yè)大小。

實(shí)現(xiàn)了分頁(yè)顯示,當(dāng)然少不了翻頁(yè)條,PageBar 標(biāo)簽可以完成翻頁(yè)。

上例中所用的CSS樣式如下,放在網(wǎng)頁(yè)頭部。

<style type="text/css">
/* 分頁(yè)欄樣式 */
.pageBar {overflow:auto;}
.pageBar .info {margin-bottom:10px;}
.pageBar .info span.count {font-weight:bold; color:#F60; font-size:12px;padding:5px;}
.pageBar .plist strong { display:block; float:left; color:#FFF; background:#F60; 
    border:1px solid #C33; padding-left:8px; padding-right:8px; margin-right:3px;}
.pageBar .plist a{ display:block; float:left; color:#000; background:#FFF; 
   border:1px solid #DDD; padding-left:8px; padding-right:8px; text-decoration:none; margin-right:3px; }
.pageBar .plist a:hover{ color:#F60;background:#EEE}
</style>

內(nèi)容頁(yè)相關(guān)文檔列表[ ]

<table width="98%" cellpadding="1" cellspacing="0">
{Yu:ContList ListType="Relation" Count="10" Sort="AddTime" Order="DESC"}
<tr><td width="10"> · </td><td><a href="{@ContPath/}" title="{@FullTitle/}" target="_blank">{@Title/}</a></td>
</tr>
{/Yu:ContList}
</table>
YulinCMS ContListTags13.gif
  • 標(biāo)簽解釋

獲取當(dāng)前文檔Tag相關(guān)的10篇文檔,顯示其標(biāo)題。

  • 其它說(shuō)明

注意ContList標(biāo)簽的屬性 ListType 它用來(lái)指定列表類型。

這個(gè)例子中的 ListType="Relation" 意思是這個(gè)內(nèi)容列表用來(lái)獲取和當(dāng)前內(nèi)容Tag相關(guān)的內(nèi)容 僅用于內(nèi)容頁(yè)模板中。

例如:當(dāng)前內(nèi)容的 Tag 是“google 谷歌 安全”則調(diào)用庫(kù)中所有含有該 Tag 的內(nèi)容。

如果只想從內(nèi)容所屬的欄目中獲取相關(guān)內(nèi)容??梢允褂?Cate="Current" 這個(gè)屬性。

如果只想從內(nèi)容所屬的欄目分類中獲取相關(guān)內(nèi)容??梢允褂?Class="Current"這個(gè)屬性。 欄目分類需要事先在后臺(tái)設(shè)置好。

隨機(jī)文檔列表[ ]

{Yu:ContList Count="10" Sort="Rand"}
{@Title/}<br/>
{/Yu:ContList}
YulinCMS ContListTags14.gif
  • 標(biāo)簽解釋

隨機(jī)獲取庫(kù)中的10篇文檔

  • 其它說(shuō)明

這個(gè)例子中的 Sort="Rand" 意思是隨機(jī)排序。

也可以可隨機(jī)獲取指定條件的內(nèi)容列表。例如: 加上Cate屬性 用來(lái)獲取某個(gè)欄目下的隨機(jī)文檔, 加上Where屬性 用來(lái)獲取指定條件的文檔。

相關(guān)條目[ ]

參考來(lái)源[ ]