Jump to content

Please help: Create new rows on a div table. tpl file ext


php-newbies

Recommended Posts

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.

 

{include file='t_javascript_language.tpl'}
{set_css}
{set_js}

<!--<div class="componentheading">{$page_title}</div>-->

<div class="adds_man_list">
<span>{$category_pathway}</span>
{if $current_category->catname!=""}
<div style="border:2px solid #000;">
	{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> </td>
    {/section}
</tr>
</table>
</div>

 

Many thanks in advance for your help

Back in the original code, when you had two columns, did adding a category work correctly? The code changes so far where to modify the code that produced two columns per row to produce n columns per row. I suspect that isn't even what you wanted to do.

 

Mock-up and post a table showing what output you do want with some sample categories/sub-categories, and someone can probably help you.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.