Forums / Setup & design / What is wrong in this code?

What is wrong in this code?

Author Message

SathishKumar Subramanian

Friday 21 November 2003 2:29:43 am

HI,

I am having a set of 25 language names. I want to publish the languages in a table with 8 columns. So the result should be 4 rows and in the last row except 1st column remaining columns are empty.

I have used the following code to publish the languages in my page. But the "set" is not incrementing the value correctly.

How can I make this to work perfect?

{let langCount=fetch( 'content', 'list_count',
hash( 'parent_node_id', 44) )} {* article count *}
{section show=gt(langCount,0)}
{let language_list=fetch( content, tree, hash( parent_node_id, 44,
limit, $langCount,
sort_by, array( "priority", true() ),
class_filter_type, include,
class_filter_array, array(1) ) ) }
{let langInc=0}
{let tdTagStart=0}
{section name=languages loop=$language_list} {* language list *}
{set langInc=$langInc|inc}

{switch name=trLoop match=$tdTagStart}
{case match=0}
{set tdTagStart=$tdTagStart|inc} {* increment td count *}
<tr>
<td>      <a class="link" href={concat("/content/view/full/",$languages:item.node_id,"/")|ezurl} alt={$languages:item.name|wash} title={$languages:item.name|wash}>{attribute_view_gui attribute=$languages:item.data_map.name_language}</a>
</td>
{/case}

{case match=8} {* if td count is 8 *}
</tr>
{section show=gt(sub($langCount,$langInc),0)}
{set tdTagStart=$tdTagStart|inc} {* increment td count *}
<tr>
<td>      <a class="link" href={concat("/content/view/full/",$languages:item.node_id,"/")|ezurl} alt={$languages:item.name|wash} title={$languages:item.name|wash}>{attribute_view_gui attribute=$languages:item.data_map.name_language}</a>
</td>
{section-else}
{set tdTagStart=0} {* make tdcount as 0 *}
{/section}
{/case}

{case}
{set tdTagStart=$tdTagStart|inc} {* increment td count *}
<td>      <a class="link" href={concat("/content/view/full/",$languages:item.node_id,"/")|ezurl} alt={$languages:item.name|wash} title={$languages:item.name|wash}>{attribute_view_gui attribute=$languages:item.data_map.name_language}</a>
</td>
{/case}
{/switch}

{/section}
{section show=ne(tdTagStart,0)} {* show section if td count not equal to 0 *}
<td colspan="{$tdTagStart}"> </td></tr> {* colspan statement *}
{/section}
{/let}
{/let}
{/let}
{section-else}
<tr><td colspan="8"> </td></tr>
{/section}
{/let}

Thanx in advance :)

Sathizh