exclude a section from the node_list

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

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 18 2025 15:53:13
Script start
Timing: Jan 18 2025 15:53:13
Module start 'layout'
Timing: Jan 18 2025 15:53:13
Module start 'content'
Timing: Jan 18 2025 15:53:14
Module end 'content'
Timing: Jan 18 2025 15:53:14
Script end

Main resources:

Total runtime1.1959 sec
Peak memory usage4,096.0000 KB
Database Queries77

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 588.0313152.6406
Module start 'layout' 0.00510.0035 740.671939.4766
Module start 'content' 0.00861.1860 780.1484578.3594
Module end 'content' 1.19470.0012 1,358.507820.1406
Script end 1.1959  1,378.6484 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.2802160.0002
Check MTime0.00140.1167160.0001
Mysql Total
Database connection0.00070.059810.0007
Mysqli_queries1.126794.2084770.0146
Looping result0.00070.0579750.0000
Template Total1.160597.020.5803
Template load0.00220.187320.0011
Template processing1.158296.847920.5791
Template load and register function0.00020.016410.0002
states
state_id_array0.00070.059110.0007
state_identifier_array0.00120.101920.0006
Override
Cache load0.00200.1680490.0000
Sytem overhead
Fetch class attribute can translate value0.00060.048730.0002
Fetch class attribute name0.00120.103790.0001
XML
Image XML parsing0.00030.025930.0001
class_abstraction
Instantiating content class attribute0.00000.002790.0000
General
dbfile0.00390.3294100.0004
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
9content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
13content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 31
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs