Forums / Setup & design / exclude a section from the node_list

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

eZ debug

Timing: Jan 18 2025 11:21:35
Script start
Timing: Jan 18 2025 11:21:35
Module start 'content'
Timing: Jan 18 2025 11:21:35
Module end 'content'
Timing: Jan 18 2025 11:21:35
Script end

Main resources:

Total runtime0.2116 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0288 589.2578180.8281
Module start 'content' 0.02880.0098 770.0859101.9141
Module end 'content' 0.03860.1729 872.0000531.8281
Script end 0.2115  1,403.8281 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00421.9888200.0002
Check MTime0.00170.8057200.0001
Mysql Total
Database connection0.00351.663110.0035
Mysqli_queries0.129561.22531410.0009
Looping result0.00170.79241390.0000
Template Total0.172481.510.1724
Template load0.00110.538810.0011
Template processing0.171380.940510.1713
Override
Cache load0.00080.378210.0008
Sytem overhead
Fetch class attribute can translate value0.00070.309710.0007
XML
Image XML parsing0.00020.106810.0002
General
dbfile0.01697.9712200.0008
String conversion0.00000.006130.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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