2012-04-25 77 views
0

我需要輸出每個'文章','Id',一次鏈接到所有菜單,全部在一個頁面中,每個div id = articleID。輸出可以是與模塊句柄,我可以安裝和更新的Joomla這個模塊低於2.5'article','joomla'中的'Id'模塊2.5

回答

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