ecshop跨表调用论坛数据方法,注意两个网站的数据表和我们ecshop的表在一个数据库的情况下
$subject_list = $db->getAll("select tid,subject,dateline from cdb_post where fid=54 limit 0,10"); foreach($subject_list as $idx=>$value) { $subject_list[$idx]['subject'] = sub_str($value['subject'],8);//字符串截取 $subject_list[$idx]['dateline'] = date($GLOBALS['_CFG']['date_format'], $value['dateline']);//格式化时间 } $smarty->assign('subject_list',$subject_list);
贴到.php
<!-- {foreach from=$subject_list item=list } --> <li><a href="bbs/forum.php?mod=viewthread&tid={$list.tid}" target="_blank">{$list.subject}</a><span>{$list.dateline}</span></li> <!-- {/foreach} -->