当前位置:首页 > 帝国教程
帝国CMS如何调用会员空间信息

来源:搜你想要的 点击数: 时间:07-18

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

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

  1. <?php
  2. $spacesql=espace_eloop(栏目ID,显示条数,操作类型,只显示有标题图片);
  3. while($spacer=$empire->fetch($spacesql))
  4. {
  5. $spacesr=espace_eloop_sp($spacer);
  6. ?>
  7. 模板代码内容
  8. <?
  9. }
  10. ?>

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:用空间“灵动标签函数”实现如下图效果

帝国CMS如何调用会员空间信息 第1张

实现代码为如下:

  1. <table width="380" border="0" cellpadding="3" cellspacing="1" bgcolor="#96C8F1" align="center">
  2. <tr>
  3. <td background="template/default/images/bg_title_sider.gif"><b>最新新闻</b></td>
  4. </tr>
  5. <tr>
  6. <td bgcolor="#FFFFFF">
  7. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  8. <?php
  9. $spacesql=espace_eloop(2,5,0,0);
  10. while($spacer=$empire->fetch($spacesql))
  11. {
  12. $spacesr=espace_eloop_sp($spacer);
  13. ?>
  14. <tr>
  15. <td height="25">
  16. <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])?>)
  17. </td>
  18. </tr>
  19. <?
  20. }
  21. ?>
  22. </table>
  23. </td>
  24. </tr>
  25. </table>

说明:调用栏目ID=2的最新5条信息。(date为时间格式化函数)

例子2:用空间“灵动标签函数”实现如下图效果

帝国CMS如何调用会员空间信息 第2张

实现代码为如下:

  1. <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#96C8F1" align="center">
  2. <tr>
  3. <td background="template/default/images/bg_title_sider.gif"><b>图片新闻</b></td>
  4. </tr>
  5. <tr>
  6. <td bgcolor="#FFFFFF">
  7. <table width="100%" border="0" cellspacing="1" cellpadding="3">
  8. <tr>
  9. <?php
  10. $spacesql=espace_eloop(2,4,0,1);
  11. while($spacer=$empire->fetch($spacesql))
  12. {
  13. $spacesr=espace_eloop_sp($spacer);
  14. ?>
  15. <td height="25" align="center">
  16. <a href="<?=$spacesr[titleurl]?>" target="_blank"><img src="<?=$spacer[titlepic]?>" width="108" height="72" border="0"></a>
  17. <br>
  18. <a href="<?=$spacesr[titleurl]?>" target="_blank"><?=esub($spacer[title],20)?></a>
  19. </td>
  20. <?
  21. }
  22. ?>
  23. </tr>
  24. </table>
  25. </td>
  26. </tr>
  27. </table>

说明:调用带标题图片的最新4条信息。(esub为截取字数函数

广告推介

最新发布

图文信息

最新视频

热门事件

资源共享