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

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

,下载以下补丁包,然后解压覆盖到网站根目录下。

点击这里下载,支持sql标签的补丁包

下面我们将织梦和易优的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}

实用干货原创整理,转载请注明九九主题出处!本站所有资源均可以下载,qq一键登录购买SVIP更实惠,免注册扫码支付更方便。
九九主题 » 不支持sql标签,可以用其他标签方式代替