Joomla模块学习之后台mod

    技术2022-05-20  58

    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>

     

     


    最新回复(0)