帝國(guó)CMS會(huì)員空間信息標(biāo)簽調(diào)用
帝國(guó)CMS6.0版新增了針對(duì)會(huì)員空間信息調(diào)用的“靈動(dòng)標(biāo)簽函數(shù)”,使會(huì)員空間模板增加信息調(diào)用更簡(jiǎn)單,不用寫(xiě)sql查詢執(zhí)行代碼。
空間的“靈動(dòng)標(biāo)簽函數(shù)”語(yǔ)法基本同靈動(dòng)標(biāo)簽。
空間的“靈動(dòng)標(biāo)簽函數(shù)”具體語(yǔ)法為如下:
<?php$spacesql=espace_eloop(欄目ID,顯示條數(shù),操作類型,只顯示有標(biāo)題圖片);while($spacer=$empire->fetch($spacesql)){ $spacesr=espace_eloop_sp($spacer);?>模板代碼內(nèi)容<?}?>
1、espace_eloop函數(shù)的參數(shù)怎么跟靈動(dòng)標(biāo)簽一樣?是的,參數(shù)完全一樣,設(shè)置的內(nèi)容也是一樣,支持靈動(dòng)標(biāo)簽的所有操作類型。
“欄目ID”:多個(gè)欄目ID、專題ID與標(biāo)題分類ID可用,號(hào)格開(kāi),如'1,2'; 如果是按SQL語(yǔ)句調(diào)用,則此處為SQL語(yǔ)句。
“顯示條數(shù)”:顯示前幾條記錄。
“操作類型”:同標(biāo)簽調(diào)用的操作類型。
“只顯示有標(biāo)題圖片”:0為不限制,1為只顯示有標(biāo)題圖片的信息。
2、$spacer變量是什么?$spacer相當(dāng)于靈動(dòng)標(biāo)簽的“$bqr”變量:
$spacer[字段名]
3、$spacesr=espace_eloop_sp($spacer);是什么作用?“espace_eloop_sp”函數(shù)是返回特殊字段內(nèi)容數(shù)組,相當(dāng)于靈動(dòng)標(biāo)簽的$bqsr變量:
$spacesr[titleurl]:標(biāo)題鏈接$spacesr[classname]:欄目名稱$spacesr[classurl]:欄目鏈接
舉例說(shuō)明
例子1:用空間“靈動(dòng)標(biāo)簽函數(shù)”實(shí)現(xiàn)如下圖效果
代碼如下:
<table width="380" border="0" cellpadding="3" cellspacing="1" bgcolor="#96C8F1" align="center"> <tr> <td background="template/default/images/bg_title_sider.gif"><b>最新新聞</b></td> </tr> <tr> <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <?php $spacesql=espace_eloop(2,5,0,0); while($spacer=$empire->fetch($spacesql)) { $spacesr=espace_eloop_sp($spacer); ?> <tr> <td height="25"> <img src="template/default/images/li.gif" width="15" height="10"><a href="<?=$spacesr[titleurl]?>" target="_blank"><?=$spacer[title]?></a> (<?=date('Y-m-d',$spacer[newstime])?>) </td> </tr> <? } ?> </table> </td> </tr></table>
說(shuō)明:調(diào)用欄目ID=2的最新5條信息。(date為時(shí)間格式化函數(shù))