Object fetch by name possible?

Author Message

Claus Jensen

Tuesday 09 December 2003 2:25:01 am

Hello!
Is is possible to fetch objects by name instead of by id's? Cant find any doc's on this.

Any tips, tricks or fancy ideas are welcome!

regards,
claÜs

laurent le cadet

Wednesday 10 December 2003 6:27:42 am

Hi,

You can fetch content like in the in the search.tpl.

Try something like this :

{let search=fetch(content,search,hash(subtree_array,35,class_id,23,class_attribute_id,337,text,'MyWord'))}
{$search['SearchResult']}
{$search['SearchCount']}
{/let}

Subtree, class_id, class_attribute are optionnels but very usefull.

read more here : http://www.ez.no/developer/ez_publish_3/documentation/customization/components/search/search_operator

Laurent

Claus Jensen

Wednesday 10 December 2003 6:46:44 am

Thanks for reply Laurent,
but I have tried numerous versions of this now, and I get bloody nothing when trying to print out the list count. I think its a bug like the rest of ezpublish;)

My version is 3500(3.2-1) and it should work according to the link you provided: "Note: Available from eZ publish 3.2 and revision 2853. "
Here is my exact code:

{let search=fetch("content",search,hash(text,"service")}
{$search['SearchCount']}
{$search['SearchResult']}
{/let}

Anyone see something wrong here?

Cheers,
claÜs

laurent le cadet

Wednesday 10 December 2003 6:53:25 am

A bug like the rest of ez p... (?)
I'm sre you are joking.
In my case it works well.

What I noticed in your code is :

{let search=fetch("content",search,hash(text,"service")}
{$search['SearchCount']}
{$search['SearchResult']}
{/let}

I'm not sure double quote is the correct try :

{let search=fetch(content,search,hash(text,'service'))}
{$search['SearchCount']}
{$search['SearchResult']}
{/let}

and take care with the ()

Claus Jensen

Wednesday 10 December 2003 7:13:19 am

Got it! There was an unclosed let tag above im my code, and also I had forgot to close a ) ;) thanks!

Seems it works now!

cheers,
claÜs

laurent le cadet

Wednesday 10 December 2003 7:28:16 am

You was the bug ;-)

See you.

Laurent

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.