Author
|
Message
|
Lydie Soler
|
Thursday 04 August 2005 2:02:06 am
Hi,
I have added a node list to my site. I would like to exculde a specific section from it. I know I should change the tpl file. Is there a way to change the fetch function or should I add a condition? I am not very good at programming.... here is the code :
<div class="toolbar-item {$placement}">
{section show=or($show_subtree|count_chars()|eq(0), $requested_uri_string|begins_with( $show_subtree ))}
{cache-block keys=$tool_id}
{default limit=5}
{section show=$sort_by|count|eq( 0 )}{set sort_by='published'}{/section}
{let node_list=cond( $treelist_check|eq( 'yes' ),
fetch( content, tree, hash( parent_node_id, $parent_node,
limit, $limit,
class_filter_type, exclude,
class_filter_array, array( 'folder' ),
sort_by, array( $sort_by, false() ) ) ),
fetch( content, list, hash( parent_node_id, $parent_node,
limit, $limit,
class_filter_type, exclude,
class_filter_array, array( 'folder' ),
sort_by, array( $sort_by, false() ) ) ) )}
<div class="toollist">
<div class="toollist-design">
<h2>{$title}</h2>
<div class="content-view-children">
{section name=Node loop=$node_list sequence=array(bglight,bgdark)}
{node_view_gui view=listitem content_node=$Node:item}
{/section}
</div>
</div>
</div>
{/let}
{/default}
{/cache-block}
{/section}
</div>
|
John Smith
|
Thursday 04 August 2005 2:38:43 am
hi Soler, Use the code below {section-exclude match=$menu.id|eq(node_id)} where node_id is the node you want to exclude. Also replace $menu.id with the variable you using in the section loop. This will do for you.
|
Lydie Soler
|
Thursday 04 August 2005 3:19:55 am
Sorry but I don't know how to include your code in the existing code... I haven't found any explanation in the documentation... Can you be more precise? Thanks a lot Lydie
|
Lydie Soler
|
Thursday 04 August 2005 6:50:20 am
well I would like to change the fetch function in order to say that I exclude the article which belongs to a specific section... I though of something like this... (which of course doesn't work)
fetch( content, list, hash( parent_node_id, $parent_node,
limit, $limit,
class_filter_type, exclude,
class_filter_array,
array( 'article/object/section_id', '=', '6' ) ,
sort_by, array( $sort_by, false() ) )
Any idea of what I need to change??? THanks
|
Lydie Soler
|
Thursday 04 August 2005 8:53:04 am
well I had an idea. I remove the limit from the fetch function. Then I add a condition in order to exclude the element from the section. Then I would like to limit the number of elements I display. Here is my code:
<div class="toolbar-item {$placement}">
{section show=or($show_subtree|count_chars()|eq(0), $requested_uri_string|begins_with( $show_subtree ))}
{cache-block keys=$tool_id}
{default limit=5}
{section show=$sort_by|count|eq( 0 )}{set sort_by='published'}{/section}
{let node_list=cond( $treelist_check|eq( 'yes' ),
fetch( content, tree, hash( parent_node_id, $parent_node,
class_filter_type, exclude,
class_filter_array, array( 'folder' ) ,
sort_by, array( $sort_by, false() ) ) ),
fetch( content, list, hash( parent_node_id, $parent_node,
class_filter_type, exclude,
class_filter_array,
array( 'folder' ) ,
sort_by, array( $sort_by, false() ) ) ) )}
<div class="toollist">
<div class="toollist-design">
<h2>{$title}</h2>
<div class="content-view-children">
{section name=Node loop=$node_list sequence=array(bglight,bgdark)}
{if or(eq($Node:item.object.section_id,6), eq(0,$limit))}
{else}
{node_view_gui view=listitem content_node=$Node:item}
{set limit=$limit|dec}
{/if}
{/section}
</div>
</div>
</div>
{/let}
{/default}
{/cache-block}
{/section}
</div>
So I try to decrease the limit variable but nothing seems to happen.... But the code it self work ....Don't understand at all... Please help me ....
|
Joanie Chembars
|
Tuesday 09 August 2005 7:05:21 am
Don't know if I can help, but..... do you want to exclude everything within a certain section from your search?or is just that one class?
|
Lydie Soler
|
Tuesday 09 August 2005 7:13:04 am
Hi, I want to exclude everything from the considered section.
|
Joanie Chembars
|
Tuesday 09 August 2005 9:38:32 am
Just a guess here - i am not a programmer either -- did you try changing the set variable line from {default limit=5} to {def $limit=5}
|
Lydie Soler
|
Wednesday 10 August 2005 2:24:55 am
Hi I have found the solution so here it is:
{section name=Node loop=$node_list sequence=array(bglight,bgdark)}
{section-exclude match=$Node:item.object.section_id|eq(6)} {node_view_gui view=listitem content_node=$Node:item} {/section} thanks for help
|