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.

eZ debug

Timing: Jan 18 2025 22:38:21
Script start
Timing: Jan 18 2025 22:38:21
Module start 'layout'
Timing: Jan 18 2025 22:38:21
Module start 'content'
Timing: Jan 18 2025 22:38:22
Module end 'content'
Timing: Jan 18 2025 22:38:22
Script end

Main resources:

Total runtime0.8671 sec
Peak memory usage4,096.0000 KB
Database Queries66

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 587.9141152.6250
Module start 'layout' 0.00580.0027 740.539139.4453
Module start 'content' 0.00850.8573 779.9844546.4609
Module end 'content' 0.86580.0013 1,326.445316.1641
Script end 0.8671  1,342.6094 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00380.4350160.0002
Check MTime0.00160.1811160.0001
Mysql Total
Database connection0.00070.080510.0007
Mysqli_queries0.799792.2205660.0121
Looping result0.00060.0724640.0000
Template Total0.836196.420.4181
Template load0.00220.258020.0011
Template processing0.833996.163720.4169
Template load and register function0.00010.014310.0001
states
state_id_array0.00090.101810.0009
state_identifier_array0.00110.128920.0006
Override
Cache load0.00200.2336580.0000
Sytem overhead
Fetch class attribute can translate value0.00050.061220.0003
Fetch class attribute name0.00200.232070.0003
XML
Image XML parsing0.00070.078320.0003
class_abstraction
Instantiating content class attribute0.00000.003090.0000
General
dbfile0.00070.0861160.0000
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
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
11content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
14content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 36
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs