Forums / Setup & design / can't increment my variable....

can't increment my variable....

Author Message

Lydie Soler

Tuesday 07 February 2006 2:10:45 am

hi ,

I have the following template

{let 
node_list=
                         fetch( content, tree, hash( parent_node_id, $parent_node,
                                class_filter_type, include,
                                class_filter_array, array( 'article','folder'),
					            sort_by, array( 'modified', false() ) ) )
                    }
{let compteur=0}

{section name=Node loop=$node_list sequence=array(bglight,bgdark)}

{section-exclude match=$Node:item.object.section_id|eq(6)}
{section-exclude match=$Node:item.object.section_id|eq(11)}
{section-exclude match=$Node:item.object.section_id|eq(8)}
{set compteur=compteur|inc}
{$compteur}
        {node_view_gui view=listitem content_node=$Node:item}

 {delimiter },{/delimiter}

{/section}
{/let}
{/let}

My goal is to increment the compteur variable. But it doesn"t do anything.... I have tried many things... but I am running out of idea.... Please help!

Mads Ovesen

Tuesday 07 February 2006 11:57:25 am

Try

{set $compteur=inc( $compteur )}

instead. I think the problem is, that you cannot use inc the way you do to increment the value of a variable. That way you can only increment numbers, for instance: {10|inc} would return 11.

/m