Discuz!官方免费开源建站系统

 找回密码
 立即注册
搜索

[已答复] 可以在xml中使用Discuz!代码吗?

[复制链接]
yunliangstar 发表于 2009-8-5 23:10:20 | 显示全部楼层 |阅读模式
<?xml version="1.0" encoding="utf-8"?>
    <thumbnails>
      <!--{block name="spacegoods" parameter="dateline/11604800/order/i.replynum DESC/subjectlen/12/limit/0,18/showdetail/1/cachetime/33800/cachename/picgoods/tpl/data"}-->
      <!--{loop $_SBLOCK['picgoods'] $value}-->
      <thumbnail filename="$value[thumb]" url="$value[url]" target="_blank"
                title="$value[subject]"
                description="$value[subject]" />
      <!--{/loop}-->
    </thumbnails>


我写上面的代码想实现的下面的意思
<?xml version="1.0" encoding="utf-8"?>
    <thumbnails>
        <thumbnail filename="商品图片地址1" url="相应链接1" target="_blank"
                title=""
                description="商品描述" />
        <thumbnail filename="商品图片地址2" url="相应链接2" target="_blank"
                title=""
                description="商品描述" />
        <thumbnail filename="商品图片地址3" url="相应链接3" target="_blank"
                title=""
                description="商品描述" />
如此循环....
    </thumbnails>
回复

使用道具 举报

littlehz 发表于 2009-8-5 23:49:33 | 显示全部楼层
<!--{}-->这些是SupeSite的模版代码,只能在模版文件中使用。和Discuz!无关吧。
当然,你可以考虑利用频道变通的方法。

新建一个英文名叫abc的频道,生成基本运行文件,这个频道的访问地址是http://yourdomain.com/?action-channel-name-abc 这样的。如果是rewrite的URL也就是http://yourdomain.com/action-channel-name-abc.html这样的URL。

这个abc频道对应的模版文件是channel下的templates下的channel_abc.html.php,把上面写的代码全部放这个文件,删除其他的代码。

为了确保访问这个频道,服务器返回的MIME类型是xml,还应该修改channel下的channel-abc.php文件,加上php设置header的MIME为text/xml的语句。

最后,通过http://yourdomain.com/?action-channel-name-abc访问到的是你制作的XML文件。
回复

使用道具 举报

 楼主| yunliangstar 发表于 2009-8-6 10:25:45 | 显示全部楼层
Practise Moderator 你好 "加上php设置header的MIME为text/xml的语句。"这个语句怎么写呀?我不明白
回复

使用道具 举报

lidq.jingwu 发表于 2009-8-6 10:35:41 | 显示全部楼层
header('Content-Type: text/xml');
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-9-12 09:07 , Processed in 0.077945 second(s), 14 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表