迅睿CMS外部网站如何调用CMS数据

在外部网站或者静态html页面上调用迅睿cms数据方法

1、在迅睿cms中开启开发者模式,index.php开启

2、然后访问迅睿cms首页,并查看源代码,如下图:

3、按照上图标记的地址,创建一个模板

/template/pc/default/home/api/waibu.html

 

4、模板内容,随便写,你可以用标签查询news模块的数据,例如

{module module=news num=10} <a href="{$t.url}">{$t.title}</a>{/module}

 

5、然后在外部网站或者静态html页面加入以下代码,就可以读取到迅睿cms内容了

<div id="xunruicms_news"></div>
<script type="text/javascript">
    $.ajax({
        type: "GET",
        url:"http://网站.com/index.php?s=api&c=api&m=template&name=waibu.html&format=jsonp",
        dataType: "jsonp",
        success: function(json){
            $("#xunruicms_news").html(json.msg);
        },
        error: function(){ }
    });
</script>

 

注意:页面需要提前加载jquery

迅睿CMS外部网站如何调用CMS数据

相关文章:

你感兴趣的文章:

标签云: