不支持sql标签,可以用其他标签方式代替

如果网站不是v1.5.4版本,请先升级到最新版v1.5.5

下面我们将织梦和易优的sql标签进行对比转换,大家在学习时留意两个系统语法的相似之处。

注意事项:
1、示例中 __PREFIX__ 代表数据表的前缀,假设你安装网站时数据表前缀是ey_,那么 __PREFIX__arctype 就是 ey_arctype

——————————- 示例1 —————————-
织梦:调用指定栏目的封面页内容,比如栏目ID是1
{dede:sql sql=”select content from dede_arctype where id=1″}
    [field:content function=cn_substr(Html2Text(@me),600)/]
{/dede:sql}
易优:指定栏目的封面页内容,比如栏目ID是1,在易优这边只有单页模型的栏目才有封面页内容
{eyou:sql sql=’select content from `__PREFIX__single_content` where typeid = 1′ id=’field’}
    {$field.content|html_msubstr=###,0,300,true}
{/eyou:sql}
或者
{eyou:type typeid=’1′ addfields=’content’ id=’field’}
    {$field.content|html_msubstr=###,0,300,true}
{/eyou:type}
——————————- 示例2 —————————-
织梦:调用指定栏目的数据,比如栏目ID是1
{dede:sql sql=”select * from dede_arctype where id=1″}
    栏目ID:[field:id/]
    栏目名称:[field:typename/]
    栏目链接:[field:typelink/]
{/dede:sql}
易优:调用指定栏目的数据,比如栏目ID是1
{eyou:sql sql=’select * from `__PREFIX__arctype` where id = 1′ id=’field’}
    栏目ID:{$field.id}
    栏目名称:{field:typename}
    栏目链接:{field:typeurl}
{/eyou:sql}
或者
{eyou:type typeid=’1′ id=’field’}
    栏目ID:{$field.id}
    栏目名称:{field:typename}
    栏目链接:{field:typeurl}
{/eyou:type}

——————————- 示例3,sql标签可以用php标签代替 —————————-

织梦:调用指定栏目的数据,比如栏目ID是1
{dede:sql sql=”select * from dede_arctype where id=1″}
    栏目ID:[field:id/]
    栏目名称:[field:typename/]
    栏目链接:[field:typelink/]
{/dede:sql}
易优:调用指定栏目的数据,比如栏目ID是1
{eyou:php}
    $sql = ‘select * from ey_arctype’;
    $tmp_list = db()->query($sql);
    foreach ($tmp_list as $_k => $_v) {
        echo “栏目ID:”.$_v[‘id’];
        echo ” — “;
        echo “栏目名称:”.$_v[‘typename’];
        echo ” — “;
        echo “栏目链接:”.typeurl(‘home/Lists/index’, $_v);
        echo “<br/>”;
    }
{/eyou:php}

原文链接:http://www.zsiss.com/333.html,转载请注明出处。

0

评论0

请先

爱分享推出ChatGPT国内镜像,无需魔法直接用!写文章,写代码,做PPT,做网站原创软文效果好到爆炸 https://chat.gcrup.com

社交账号快速登录