dede调用非同一个数据库的DZ论坛的帖子


{dede:php runphp="yes"}  $GLOBALS['cfg_dbname']="数据库名";    $tsql = new DedeSql(false);  $tags = '';  $tsql->SetQuery("SELECT cdb_forums.name,cdb_threads.fid,cdb_threads.tid,cdb_threads.subject FROM cdb_threads,cdb_forums where  cdb_threads.fid=cdb_forums.fid and cdb_threads.digest>0 and cdb_threads.displayorder!=-1 order by cdb_threads.lastpost desc  LIMIT 0,10");  $tsql->Execute('t');  $tg_ko=1;  while($tgrow = $tsql->GetArray('t',MYSQL_ASSOC)){  $arr_tgrand=array('5f8b69','2a5c8b','c02846','b17134','006d57','666666','666666');  shuffle($arr_tgrand);      $tgtags .= '<li id="c_po'.$tg_ko.'"><a href=" http://xxx/forum-'.$tgrow[fid].'-1.html" target="_blank">[<font color="#'.$arr_tgrand[0].'">'.$tgrow[name].']</font></a> <a href=" http://xxx/thread-'.$tgrow['tid'].'-1-1.html" title="'.$tgrow[subject].'" target="_blank">'.$tgrow[subject].'</a></li>    ';    $tg_ko++;               }  @me=$tgtags;  {/dede:php} 
本文转自小猪站长学院,原文地址: http://www.pigzz.com/201012/12161RR010.html

猜你喜欢

转载自blog.csdn.net/liaohongchu/article/details/7679790