公告:魔扣目录网为广大站长提供免费收录网站服务,提交前请做好本站友链:【 网站目录:https://www.morko.net 】, 免友链快审服务(50元/站),

点击这里在线咨询客服
新站提交
  • 网站:51998
  • 待审:31
  • 小程序:12
  • 文章:1030137
  • 会员:747

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

空间的“灵动标签函数”语法基本同灵动标签,

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

<?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为截取字数函数)

分享到:
标签:帝国 标签 模板 解密 调用
用户无头像

网友整理

注册时间:

网站:5 个   小程序:0 个  文章:12 篇

  • 51998

    网站

  • 12

    小程序

  • 1030137

    文章

  • 747

    会员

赶快注册账号,推广您的网站吧!
最新入驻小程序

数独大挑战2018-06-03

数独一种数学游戏,玩家需要根据9

答题星2018-06-03

您可以通过答题星轻松地创建试卷

全阶人生考试2018-06-03

各种考试题,题库,初中,高中,大学四六

运动步数有氧达人2018-06-03

记录运动步数,积累氧气值。还可偷

每日养生app2018-06-03

每日养生,天天健康

体育训练成绩评定2018-06-03

通用课目体育训练成绩评定