View Full Version : Adding Item Count To Menu

09-06-2007, 04:22 AM
I am new to php and am trying to add an item count to an existing menu. The menu is created using TreeMenuXL.

The menu is a list of categories for quotes and I want to show how many quotes are in the database for each category. The picture shows an example of what I want to create.

The code for the menu currently looks like this:

if(!defined('IN_APP')) {
die('Malicious request: <b>Menu</b> could not be accessed directly!');
$intVars['content'] = '';
$intVars['content'] = $t->fetch('register.tpl');
if($gConf['category_display'] == "DHTML Menu") {
print "<script type='text/javascript'>function Go(){return}</script>\n";
print "<script type='text/javascript' src='".IHTML."/common/js/menu_var.js'></script>"; //
Retrieve categories

print '
<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
var categories = new Array();
$tmp = SetUpMenu(0,"", true, 40); $tmp = explode(",", $tmp);
$subcategory_sidebar_width = $tmp[0];
$nummenuitems = $tmp[1];
print "StartTop=515;\n";
print "var Arrws=['".IHTML."common/images/green_arrow.gif',9,10,'tridown.gif',10,5,'trileft.gif',5,10]; // Arrow source, width and height\n";
print "<script type='text/javascript' src='".IHTML."common/js/menu_com.js'></script>"; $tplVars['Menu'] = ob_get_contents();

else {
$menu00 = new HTML_TreeMenuXL();
$node0 = new HTML_TreeNodeXL('<span style="height:19px;" onMouseOver="javascript:style.cursor=\'hand\'">'.$lang['all_categories'].'</span>', "index.php?cat=0", array());
if ($gConf['category_display'] == "DHTML Tree"){
$example010 = new HTML_TreeMenu_DHTMLXL($menu00, array("expanded"=>false,"images"=>SITE."images/TMimagesAlt2"));
}elseif ($gConf['category_display'] == "HTML Tree"){
$example010 = new HTML_TreeMenu_DHTMLXL($menu00, array("isDynamic"=>false,"images"=>SITE."images/TMimages"));
}elseif ($gConf['category_display'] == "Bulleted HTML Tree"){
$example010 = new HTML_TreeMenu_RigidXL($menu00, array("expanded"=>true,"images"=>SITE."images/TMimagesRigid"));
$tplVars['Menu'] = $example010->toHTML();

Any help would be greatly appreciated!!!