Forums / Developer / Variables scope / Comment39636

Author Topic

Shurbann Martes

Sunday 18 January 2004 3:27:40 am

Comment39636

It's better to show the code I'm working on. I want to show on my frontpage the +/- 8 articles/news where people commented lately, without showing the article or news more then once.

[code]

{let comment_parent_array=array(0) // make an array, where I will put the article/news id's
comment_list=fetch(content,list,hash(parent_node_id,2,limit,12,depth,5,sort_by,array(published,false()),class_filter_type,include,class_filter_array,array('comment')))} //fetch all the latest comments
{section name=Comment loop=$comment_list} //loop trough the comments
{section show=$comment_parent_array|contains($Comment:item.parent_node_id)|not} // if the article/new has already been shown don't go trough this secton
{let $comment_parent_array|append($Comment:item.parent_node_id)} //put the id of the article/news in the array
{node_view_gui view=line content_node=$Comment:item} //show the comment
{/section}
{/section}
{/let}

[/code]

It keeps showing the articles more then once. So one way or the other the idea of checking the array or putting the parent_node_id in the array isn't working.

I have run {$comment_parent_array|attribute(show,1)} in the code above and still the array has only the value 0 (the way I defined it at the beginning) in all the sections.

I'm out of ideas. Can you see the problem?
-Shurbann