码迷,mamicode.com
首页 > 数据库 > 详细

dede模板中直接写sql语句,关联sql调用

时间:2019-01-05 19:45:43      阅读:314      评论:0      收藏:0      [点我收藏+]

标签:margin   alt   limit   str   article   直接   idt   引擎   eid   

<div>{dede:php}$row = $GLOBALS[‘dsql‘]->GetOne("select id from dede_archives where typeid=4  order by rand() LIMIT 1"); 
 $row2 = $GLOBALS[‘dsql‘]->GetOne("select body from dede_addonarticle where aid=".$row[‘id‘]);
  $pattern=‘/key=(.*?)"/‘;
  $arr = preg_match($pattern, $row2[‘body‘],$mc);
  $str = $mc[1];
  preg_replace("/\s/", "",$str);
  print_r(‘<iframe width="700" height="400" src="‘.$str.‘" frameborder="0" border="0" marginwidth="0" marginheight="0" scrolling="no" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>‘);{/dede:php}
</div>

上图匹配一个网址如图key的部分:

技术分享图片

 

若dede:php标签不管用,下图

技术分享图片

模板引擎禁用标签中,去掉“php”即可

 

dede模板中直接写sql语句,关联sql调用

标签:margin   alt   limit   str   article   直接   idt   引擎   eid   

原文地址:https://www.cnblogs.com/ximishuier/p/10225472.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!