Please help: I need to create a rows on a div table. tpl file ext

Please I need your help, I need to display root category and its sub-category data in 3 columns. The problem I have is that the code is not adding rows, every time I add new category it just create a new column instead of adding new row.

[code]{include file=‘t_javascript_language.tpl’}
{set_css}
{set_js}

{$category_pathway} {if $current_category->catname!=""}
{include file='elements/display_fields.tpl' position='categoryicon' this_add=$current_category->id}
	<strong>{$current_category->catname}</strong>
	
	<div class="adds_subcat" style="text-align:right;background:#F5F5F5; border:1px solid #FFFFFF; " >
	
	{include file='elements/display_fields.tpl' position='categorydetails' this_add=$current_category->id}
	
	<span style="font-size:12px;">
	
	{jtext text="ADS_SUBCATEGORIES"}:   {$current_category->kids} {jtext text="ADS_ADS"}: {$current_category->nr_ads}
		<a href="{$current_category->view}" title="{jtext text='ADS_VIEW_LISTINGS'}">
			<img src="{$IMAGE_ROOT}view_listings.gif" class="ads_noborder" alt="{jtext text='ADS_VIEW_LISTINGS'}" />
		</a>					
	</span>
	</div>
</div>
{/if}	
{if $categories|@count<=0}
	<h2>{jtext text="ADS_NO_CATEGORIES_DEFINED"}</h2>
{/if}
<table id="adds_categories" class="ads_table">
  <tr>
  {assign var="col" value="0"}
  {section name=category loop=$categories}
	{if $col == $numCols}
        </tr><tr>{assign var="col" value="0"}
    {/if}
		<td width="16.6%" class="adsman_catcell" valign="top">
			<div class="adds_maincat" {if $categories[category]->watchListed_flag}class="cat_watchlist"{/if}> 
				
				{include file='elements/display_fields.tpl' position='categoryicon' this_add=$categories[category]->id}
				<a href="{if $categories[category]->kids>0}{$categories[category]->link}{else}{$categories[category]->view}{/if}" >
					{$categories[category]->catname}
				</a>
				{if $categories[category]->is_new}
					<!--NEW!!-->
					<img src="{$IMAGE_ROOT}new.png" alt="new ads" />
				{/if}
				<a href="{$categories[category]->view}" title="{jtext text='ADS_VIEW_LISTINGS'}">
					<img src="{$IMAGE_ROOT}view_listings.gif" class="ads_noborder" alt="{jtext text='ADS_VIEW_LISTINGS'}" />
				</a>					
				{if $is_logged_in}
					{if $categories[category]->watchListed_flag}
						<img src="{$IMAGE_ROOT}watchlist.png" width="16"class="ads_noborder" />
					{/if}
					<a href="{$categories[category]->link_watchlist}">
						<img src="{$categories[category]->img_src_watchlist}" width="16" class="ads_noborder" title="{if $categories[category]->watchListed_flag}{jtext text='ADS_REMOVE_FROM_WATCHLIST'}{else}{jtext text='ADS_ADD_TO_WATCHLIST'}{/if}"/>
					</a>
				{/if}
				<br />
			</div>
			
			<div class="adds_subcat" style="background:#F5F5F5; border:1px solid #FFFFFF; " >
			{include file='elements/display_fields.tpl' position='categorydetails' this_add=$categories[category]->id}
			<br />
			
			{section name=subcategory loop=$categories[category]->subcategories}
			
				{include file='elements/display_fields.tpl' position='categoryicon' this_add=$categories[category]->subcategories[subcategory]->id}
				<a href="{if $categories[category]->subcategories[subcategory]->kids>0}{$categories[category]->subcategories[subcategory]->link}{else}{$categories[category]->subcategories[subcategory]->view}{/if}">{$categories[category]->subcategories[subcategory]->catname}</a> 
				{if $categories[category]->subcategories[subcategory]->is_new==1}
					<img src="{$IMAGE_ROOT}new.png" alt="new ads" />
			 	 {/if}
					({$categories[category]->subcategories[subcategory]->nr_a} {jtext text="ADS_ADS"})
				{if $categories[category]->subcategories[subcategory]->watchListed_flag}
					<img src="{$IMAGE_ROOT}watchlist.png" width="16" class="ads_noborder" />
				{/if}
				{if $is_logged_in}
				<a href="{$categories[category]->subcategories[subcategory]->link_watchlist}">
					<img src="{$categories[category]->subcategories[subcategory]->img_src_watchlist}" width="14" class="ads_noborder" title="{if $categories[category]->subcategories[subcategory]->watchListed_flag}{jtext text='ADS_REMOVE_FROM_WATCHLIST'}{else}{jtext text='ADS_ADD_TO_WATCHLIST'}{/if}"/>
				</a>
				{/if}
				<br />
				<p style="margin-left:25px;">
				{include file='elements/display_fields.tpl' position='categorydetails' this_add=$categories[category]->id}
				</p>
			{/section}
			</div>
		</td>
    {assign var="col" value="`$col+1`"}
{/section}
{assign var="remainder" value="`$numCols-$col`"}
{section name=emptyElement loop=$remainder}
    <td>&nbsp;</td>
{/section}
</tr>
</table>
[/code]

Many thanks for your help

Well, you have a lot of included files that are not listed. Also, this code is Javascript. Are you asking a PHP question here in this PHP forum?

Anyway, It looks like all of your javascript code is INSIDE of

's. 's are cells of tables, so adding more to them would add more cols, not rows. Adding more rows in the table would be handled OUTSIDE of the 's which are the tables rows. So, with the current code, I do not see any way to add a row. It would have to be at the end of one row where you would add more rows and cells… Doubt that helps much, but, something to look at… Good luck…
Sponsor our Newsletter | Privacy Policy | Terms of Service