Andreas Kaiser
|
Thursday 31 August 2006 2:20:07 am
I've been looking around the forum and think this can't be done... I'm trying to select inisde the admin area which folders are fetched by the suckerfish reloaded extension. I've created a checkbox in the folder class to select if the folder has to be displayed in the navigation menu. The code of the extension is:
{def $base=fetch( 'content', 'node', hash( 'node_id', 2 ) )}
{* FIRST LEVEL *}
{section loop=fetch(content,list,hash(parent_node_id,$top_cat, class_filter_type, "include", class_filter_array, array(1), sort_by,$base.sort_array))}
{let child_check=fetch(content,list,hash(parent_node_id,$:item.node_id, class_filter_type, "include", class_filter_array, array(1),sort_by,$base.sort_array))}<li><a {section show=$child_check|count|gt(0)}{/section} href={concat("/content/view/full/",$:item.node_id,"/")|ezurl}>{$:item.name}</a>
I've tested to add an attribute_filter, but it didn't work.
{def $base=fetch( 'content', 'node', hash( 'node_id', 2 ) )}
{* FIRST LEVEL *}
{section loop=fetch(content,list,hash(parent_node_id,$top_cat, class_filter_type, "include", class_filter_array, array(1), attribute_filter, array(198,'=',1), sort_by,$base.sort_array))}
{let child_check=fetch(content,list,hash(parent_node_id,$:item.node_id, class_filter_type, "include", class_filter_array, array(1),sort_by,$base.sort_array))}
<li>
<a {section show=$child_check|count|gt(0)}{/section} href={concat("/content/view/full/",$:item.node_id,"/")|ezurl}>{$:item.name}</a>
I'm just begining with eZPublish and not programmer...
eZ Partner in Madrid (Spain)
Web: http://www.atela.net/
|
Claudia Kosny
|
Thursday 31 August 2006 9:40:50 am
Hello Andreas The attribute filter has a slightly different structure. Here an example from the documentation:
{fetch( 'content', 'list',
hash( 'parent_node_id', 42,
'attribute_filter', array( 'or',
array( 152, '=', 'abc' ),
array( 153, '=', '42' ) ) ) )}
You can find the documentation here: http://ez.no/doc/ez_publish/technical_manual/3_8/reference/modules/content/fetch_functions/list
If you want to filter on one attribute only you can leave the first array item (the 'or' in the example, which could also be an 'and') off, as it defaults to 'and'. So the attribute filter looks like this: 'attribute_filter', array(array(198, '=', '1')) Greetings from Luxembourg Claudia
|
Daniele Nocentini
|
Friday 01 September 2006 12:57:11 am
Hello, I try this in my fetch function:
'attribute_filter', array( 'and', array(308, '=', false()), array(310, '=', false()) )
but return 0, it's wrong because there are many nodes that match this fetch.
Antica Bottega Digitale srl
http://www.abd.it
|
Daniele Nocentini
|
Friday 01 September 2006 2:35:18 am
the attributes are checkbox, in another fetch I false() and work fine
{def $list_items=fetch('content','list',hash('parent_node_id',$node.node_id,
'class_filter_type', $class_filter_type,
'class_filter_array', $class_array,
'attribute_filter', array( array( 308, '=', false() ) ),
'sort_by', $node.sort_array,
'limit', $page_limit,
'offset', $view_parameters.offset,
'depth_operator', eq))
this fetch works fine, but if I add another attributes filter does not works.
Antica Bottega Digitale srl
http://www.abd.it
|
Andreas Kaiser
|
Friday 01 September 2006 4:50:17 am
Daniele, have you tried to use 0 instead of false() (like Claudia says)? Also, when you try to add another attribute filter are you using "or"?
'attribute_filter', array( 'or',
array( 152, '=', 'abc' ),
array( 153, '=', '42' ) ) ) )}
In my case the attribute is also a checkbox and I use 0 or 1.
eZ Partner in Madrid (Spain)
Web: http://www.atela.net/
|
Daniele Nocentini
|
Friday 01 September 2006 5:33:03 am
I try:
'attribute_filter', array( 'and', array(308, '=', 0), array(310, '=', 0) )
and does not works. The question is, why if I use false and one attribute filter condition the fetch return nodes right and if I use two attribute filter condition (and logical) not works?
Antica Bottega Digitale srl
http://www.abd.it
|
Andreas Kaiser
|
Friday 01 September 2006 7:45:21 am
Have you tried to clear cache? I have been testing this (198 = checkbox / 201 = checkbox; these attributes are from the same class):
attribute_filter, array('and', array(198,'=',1), array(201,'=',1)),
and modifications with other attributes (like textline) and 'or'. Only some worked until I cleared the cache everytime I modified the template. After clearing cache it works!
eZ Partner in Madrid (Spain)
Web: http://www.atela.net/
|