帝国CMS6.0版新增了针对会员空间信息调用的“灵动标签函数”,使会员空间模板添加信息调用更简略,不必写sql查询履行代码。

空间的“灵动标签函数”语法根本同灵动标签,我们回忆下灵动标签语法:
点击这儿检查:http://www.phome.net/doc/ecmsedu/base/mbzz/html/sysbq.html#eloop


空间的“灵动标签函数”详细语法为如下:

<?php
$spacesql=espace_eloop(栏目ID,显现条数,操作类型,只显现有标题图片);
while($spacer=$empire->fetch($spacesql))
{
$spacesr=espace_eloop_sp($spacer);
?>
模板代码内容
<?
}
?>

1、espace_eloop函数的参数怎样跟灵动标签相同?是的,参数彻底相同,设置的内容也是相同,支撑灵动标签的一切操作类型。
“栏目ID”:多个栏目ID、专题ID与标题分类ID可用,号格开,如'1,2'; 如果是按SQL句子调用,则此处为SQL句子。
“显现条数”:显现前几条记载。
“操作类型”:同标签调用的操作类型。
“只显现有标题图片”:0为不约束,1为只显现有标题图片的信息。

2、$spacer变量是什么?$spacer相当于灵动标签的“$bqr”变量:
$spacer[字段名]

3、$spacesr=espace_eloop_sp($spacer);是什么作用?“espace_eloop_sp”函数是回来特别字段内容数组,相当于灵动标签的$bqsr变量:
$spacesr[titleurl]:标题链接
$spacesr[classname]:栏目称号
$spacesr[classurl]:栏目链接


举例阐明
比如1:用空间“灵动标签函数”完成如下图作用

完成代码为如下:
<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>
阐明:调用栏目ID=2的最新5条信息。(date为时刻格式化函数)

比如2:用空间“灵动标签函数”完成如下图作用

完成代码为如下:
<table width="100%" 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="1" cellpadding="3">
<tr>
<?php
$spacesql=espace_eloop(2,4,0,1);
while($spacer=$empire->fetch($spacesql))
{
$spacesr=espace_eloop_sp($spacer);
?>
<td height="25" align="center">
<a href="<?=$spacesr[titleurl]?>" target="_blank"><img src="<?=$spacer[titlepic]?>" width="108" height="72" border="0"></a>
<br>
<a href="<?=$spacesr[titleurl]?>" target="_blank"><?=esub($spacer[title],20)?></a>
</td>
<?
}
?>
</tr>
</table>
</td>
</tr>
</table>
阐明:调用带标题图片的最新4条信息。(esub为截取字数函数)

声明:有的资源均来自网络转载,版权归原作者所有,如有侵犯到您的权益 请联系邮箱:123456@qq.com 我们将配合处理!

原文地址:帝国CMS 6.0功能解密之会员空间信息标签调用发布于2023-01-19 18:59:18

相关推荐