Web_PHP_DedeCMS_{dede:php}标签嵌套查询使用;
2014-04-16 14:08
507 查看
{dede:php} // 第一次查询 $fsql = 'SELECT a.id,a.title,a.litpic,d.expert,d.introduction FROM dede_archives as a,dede_addondisease as d WHERE a.id = d.aid GROUP BY d.expert ORDER BY a.pubdate DESC LIMIT 3'; $db->Execute('first', $fsql); while($farr = $db->GetArray('first')) { $expert = $farr["expert"]; $title = $farr["title"]; $introduction = mb_substr($farr["introduction"],0,20,'gbk'); echo '<li>'; echo ' <span><a href="/plus/view.php?aid='.$farr["id"].'"><img src="'.$farr["litpic"].'" width="90" height="75" /></a></span>'; echo ' <h4><a class="blue" href="/plus/view.php?aid='.$farr["id"].'" style="line-height:18px;">'.$title.'</a></h4>'; echo ' <p>'.$expert.'</p>'; echo ' <p>'.$introduction.'...<a href="/plus/view.php?aid='.$farr["id"].'" class="red" target="_blank">[查看详细]</a></p>'; // 第二次查询(嵌套) $ssql = 'SELECT a.id,a.title FROM dede_archives as a,dede_addondisease as d WHERE a.id = d.aid and d.expert = "'.$expert.'" and a.title != "'.$title.'" ORDER BY a.pubdate DESC LIMIT 2'; $db->Execute('second', $ssql); while($sarr = $db->GetArray('second')) { echo '<a class="blue" style="line-height:18px;" href="/plus/view.php?aid='.$sarr["id"].'" >'.$sarr["title"].'</a><br />'; } echo '</li>'; } {/dede:php}
相关文章推荐
- Web_PHP_DedeCMS_{dede:php}标签使用;
- Web_PHP_DedeCMS_{dede:arclist}标签不能嵌套包含{dede:global.cfg_templets_skin/},如何解决?
- Web_PHP_DedeCMS_{dede:sql}标签用法;
- Web_PHP_DedeCMS补丁更新后{dede:php}标签不起作用问题;
- Web_PHP_织梦DedeCMS万能标签{dede:sql}的用法举例
- DEDECMS模板中dede标签使用php和if判断语句的方法
- Web_PHP_DedeCMS_利用表单使用评论功能;
- 在自己的php页面中使用dedecms标签的代码示例
- dedecms channel标签中使用php和sql
- 在自己的php页面中使用dedecms标签的代码示例
- Web_PHP_DedeCMS织梦自定义图片字段调用的问题出现{dede:img ..}
- dedecms {dede:php}标签用法介绍
- dedecms {dede:php}标签用法介绍
- dedecms无法生成首页或空白{dede:php}标签出错,空白
- dede中php标签结合sql使用方法
- dedecms {dede:php}标签用法介绍
- Web_PHP_DedeCMS_畅言评论模块操作使用说明;
- dedecms 重新{dede:flink}标签自由调用表参数[field:webname /] [field:url /] [field:logo /]
- Web_PHP_DedeCMS_datalistcp.class.php 动态分页类使用案例;
- dedecms {dede:datalist}标签下runphp='yes'不起作用