Make subcategories in template script
<p>I really need help with a script i have bought, the script has some categories, but i also need sub categories, so i added an extra field in the table traffic_categories. The original traffic_categories has id and category, but i have added sub_id also, so if the category is a main category it has 0 in sub_id, but if the category is a sub category it has the main category id in the sub_id field.. Simple..</p>

<p>The problem is the script hava an advanced template system i can´t figure out how works.
Here is the script that gets the categories from mysql:</p>

<pre><code>$result = mysql_query('SELECT category FROM traffic_categories WHERE sub_id = 0 ORDER BY category ASC;');
$iCat=2;
$CONF['categories'] = array(); $TMPL['cats'] = '';
while(list($TMPL['cat']) = mysql_fetch_row($result)) {
    $TMPL['cath'] = str_replace(' ', '+', $TMPL['cat']);
    $TMPL['cats'] .= base::do_skin('menu/cats');
    $CONF['categories'][] = $TMPL['cat'];

        $TMPL['last'] = $iCat++ % 4 === 0 ? ' last' : '';
}
</code></pre>

<p>and here is cats.html:</p>

<pre><code>&lt;div class="one-fourth{$last}"&gt;
    &lt;h5&gt;&lt;a href="/cat/{$cath}"&gt;{$cat}&lt;/a&gt;&lt;/h5&gt;
    &lt;ul class="categoryList"&gt;
        Here i want the subcategories--&gt;&lt;li&gt; - &lt;a href=""&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
&lt;/div&gt;
</code></pre>

<p>and in my frontpage.html where the categories will be showed is just {$cats}.</p>

<p>So if someone please can help me show the subcategories inside the list in cats.html where is have written "Here i want the subcategories-->", then i will be really glad, thanks.</p>
