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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 06:41:04
Script start
Timing: Jan 31 2025 06:41:04
Module start 'layout'
Timing: Jan 31 2025 06:41:04
Module start 'content'
Timing: Jan 31 2025 06:41:04
Module end 'content'
Timing: Jan 31 2025 06:41:04
Script end

Main resources:

Total runtime0.0168 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 588.1328151.2109
Module start 'layout' 0.00630.0032 739.343836.6484
Module start 'content' 0.00950.0060 775.992290.0313
Module end 'content' 0.01550.0013 866.023429.9922
Script end 0.0168  896.0156 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002514.9439140.0002
Check MTime0.00116.4402140.0001
Mysql Total
Database connection0.00116.562110.0011
Mysqli_queries0.002515.105530.0008
Looping result0.00000.136110.0000
Template Total0.00106.110.0010
Template load0.00084.755010.0008
Template processing0.00021.284110.0002
Override
Cache load0.00063.405810.0006
General
dbfile0.002213.297180.0003
String conversion0.00000.062440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs