Share » Forums » General » attribute_filter: needs more explanation

attribute_filter: needs more explanation

attribute_filter: needs more explanation

Friday 19 September 2003 7:01:09 am - 4 replies

Modified on Tuesday 23 September 2003 4:46:33 am by Thomas Brandl

Author Message

Tom Couwberghs

Tuesday 23 September 2003 5:17:27 am

I had some problems with it too. But after some trial and error I found how it works.

If you want to filter only on one parameter just leave out the third parameter. It would look like this: array('or', array(156, '=', 'foobar'))

If you don't see anything appearing that could be lots of things. My advice -- first try a fetch without attribute_filter and if that's working -> start filtering.

Also check if you clear the cache entirely. There is a little mistake of the eZ crew in the clear cache script in 3.2 stable. Consult this thread: http://ez.no/developer/ez_publish_3/forum/install_configuration/cache_wont_clear_in_32

HTH

--
T

Thomas Brandl

Tuesday 23 September 2003 6:20:54 am

Hi Tom,

fetch without filtering is no problem, did not get any further.

Do you have a working example for me, maybe the problem lies somewhere else and I'm to blind to see!?

Thomas Brandl

Tuesday 23 September 2003 7:23:19 am

found this:
eZ is trying to find the value i'm looking for in ezcontentobject_attribute.sort_key_string:
... ( a0.sort_key_string = 'aValue' ) ...

This field is empty for all my records!

Besides, I don't understand it: If I'd decide to filter on some other attribute tomorrow, how should this value find its way into sort_key_String or sort_key_int?? Should't the field to search in depend solely on the datatype used for the attribute in question - data_text, data_int or data_float?

Thanks for enlightment
t

Tom Couwberghs

Wednesday 24 September 2003 12:51:14 am

The following code works for me:

{let folder_list=fetch( content, list, hash( parent_node_id, 2, sort_by, array( array( priority ) ),
attribute_filter, array('or', array(152, '=', '0')))) }

{section name=Folder loop=$folder_list}
<td class="topmenu">
<a href={concat( "/content/view/full/", $Folder:item.node_id, "/" )|ezurl}>{$Folder:item.name|wash}</a>
</td>
{/section}
{/let}

2 remarks:

About the no errors thing -> Is debug enabled on your site? If not switch it to enabled in site.ini

Are you using version 3.2 stable, in previous versions there was a bug that generated a wrong query?
HTH

--
Tom

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu