您的位置:首页 > 其它

Joomla模块学习之后台mod_stats模块

2011-02-27 11:10 260 查看
Joomla模块学习之后台mod_stats模块

菜单统计模块

后台管理模块效果图









原理:

后台mod_stats菜单统计模块通过在后台配置相应的信息. 返回菜单统计

配置界面:









mod_stats模块结构图:









关键代码

$db =& JFactory::getDBO();
// 返回属于同一菜单项信息,以及数量
$query = 'SELECT menutype, COUNT(id) AS numitems'
. ' FROM #__menu'
. ' WHERE published = 1'
. ' GROUP BY menutype'
;
$db->setQuery( $query );
$rows = $db->loadObjectList();
?>
<table class="adminlist">
	<tr>
		<td class="title" width="80%">
			<strong><?php echo JText::_( 'Menu' ); ?></strong>
		</td>
		<td class="title">
			<strong><?php echo JText::_( 'Num Items' ); ?></strong>
		</td>
	</tr>
<?php
foreach ($rows as $row)
{
	$link = 'index.php?option=com_menus&task=view&menutype='. $row->menutype;
	?>
	<tr>
		<td>
			<a href="<?php echo $link; ?>">
				<?php echo $row->menutype;?></a>
		</td>
		<td>
			<?php echo $row->numitems;?>
		</td>
	</tr>
<?php
}
?>
</table>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: