的樣式。也可以不使用它們。
這里說(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>
獲取編號(hào)為46的欄目下最近的10篇文檔,顯示其標(biāo)題,并且標(biāo)題背景顏色交替變換。
{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}
獲取編號(hào)為46的欄目下最近的15篇文檔,每顯示5篇加一條分割線。
{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>
獲取最近的3篇 帶標(biāo)題圖片的文檔,顯示其標(biāo)題縮略圖、標(biāo)題文字。
{@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}
獲取最近的 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>
獲取最近的 4篇同時(shí)帶標(biāo)題圖片和摘要的文檔,顯示其標(biāo)題縮略圖、摘要、標(biāo)題文字。
標(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}
獲取了四個(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>
獲取編號(hào)為61的欄目下、帶標(biāo)題附件的、并且標(biāo)題附件下載次數(shù)最多的 10篇文檔,顯示帶下載鏈接的標(biāo)題。
標(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>
分頁(yè)顯示當(dāng)前欄目下的所有文檔,每頁(yè)顯示15篇, 帶一個(gè)翻頁(yè)條。
注意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>
獲取當(dāng)前文檔Tag相關(guān)的10篇文檔,顯示其標(biāo)題。
注意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}
隨機(jī)獲取庫(kù)中的10篇文檔
這個(gè)例子中的 Sort="Rand" 意思是隨機(jī)排序。
也可以可隨機(jī)獲取指定條件的內(nèi)容列表。例如: 加上Cate屬性 用來(lái)獲取某個(gè)欄目下的隨機(jī)文檔, 加上Where屬性 用來(lái)獲取指定條件的文檔。
相關(guān)條目[ ]
參考來(lái)源[ ]
|