PDA

View Full Version : adv_index cmps problem


Lionel
03-02-2005, 06:22 PM
I have a small problem. I created a module to display categories in front page. Problem is when I add more than one major category, it repeats the display as per attached image<?php

$categories = $DB_site->query("
SELECT *
FROM " . TABLE_PREFIX . "articles_category
ORDER BY categoryorder
");
$cat_cache = array();

while ($cat = $DB_site->fetch_array($categories))
{
$cat_cache[$cat['parentcategory']][] = $cat;
}

if(!empty($cat_cache))
{
foreach ($cat_cache[0] AS $parentcatrow)
{
$parentid = $parentcatrow["articles_categoryid"];
$catname = $parentcatrow["categoryname"];
$parentcat = $parentcatrow["parentcategory"];

eval('$catlistbit .= "' . fetch_template('vbArticles_categorybit') . '";');
eval('$catlistbit .= "' . fetch_template('vbArticles_categorybit_pre') . '";');

if(!empty($cat_cache[$parentid]))
{
foreach ($cat_cache[$parentid] AS $subcatrow)
{
$subcatid=$subcatrow["articles_categoryid"];
$subcatname=$subcatrow["categoryname"];
eval('$catlistbit .= "' . fetch_template('vbArticles_childcatbit') . '";');
}
}
eval('$catlistbit .= "' . fetch_template('vbArticles_categorybit_post') . '";');
eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('adv_portal_articlescategories') . '";');
}
}
?>