我需要一次在菜单中链接的每个“文章”、“Id”输出,全部在一个页面中,每个都在一个 div id=articleID 中。输出可以是带有模块的句柄,我可以在 joomla 2.5 中安装和更新这个模块
问问题
653 次
1 回答
0
下面的代码应该做:
// init
$searchBase = 'index.php?option=com_content&view=article&id=';
$articles = array();
// get all menu items and find links to articles
$menu = JFactory::getApplication()->getMenu()->getItems('type', 'component');
foreach ($items as $item) {
$id = str_replace($searchBase, '', $item->link, $count);
if ($count){
$articles[] = (int) $id;
}
}
// build query for articles info
$csvIds = implode(',', $articles);
$sql = "select id, title from #__content WHERE published=1 AND id IN ($csvIds)";
// TODO: query and process
于 2012-04-27T15:38:13.890 回答