array as parent node_id in fetch produces parse error

Author Message

Marko Žmak

Tuesday 15 March 2011 1:48:58 pm

In eZP 4.5 this code:

{def $items=fetch( 'content', 'list',
        hash( 'parent_node_id', array ( '42', '43', '45' ),
              'sort_by',        array( 'published', false() ) ) )}

Produces an error:

parser error @ ##################.tpl:7

($) expected at [fetch( 'content', 'list',
        hash( 'parent_node_id', array ( '42', '43', '45' ),
              'sort_by',        array( 'published', false() ) ) )]

But when put just 42 as parent_node_id it works OK.

Is this a bug, or did I miss something?

Note, this fecth was a copy paste from the docs.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Carlos Revillo

Tuesday 15 March 2011 1:59:56 pm

i think it's just a typo in the doc. there shouldn't be any spaces between array and the parenthesis

that's it.

fetch( 'content', 'list', hash( 'parent_node_id', <b>array(</b> '42', '43', '45' ),              'sort_by',        array( 'published', false() ) ) )fetch( 'content', 'list',        hash( 'parent_node_id', array ( '42', '43', '45' ),              'sort_by',        array( 'published', false() ) ) )

Marko Žmak

Tuesday 15 March 2011 2:05:25 pm

"

i think it's just a typo in the doc. there shouldn't be any spaces between array and the parenthesis

that's it.

fetch( 'content', 'list', hash( 'parent_node_id', <b>array(</b> '42', '43', '45' ),              'sort_by',        array( 'published', false() ) ) )fetch( 'content', 'list',        hash( 'parent_node_id', array ( '42', '43', '45' ),              'sort_by',        array( 'published', false() ) ) )
"

Oh yes...

I didn't notice the space, silly me.

Still, the docs should be corrected not to confuse newcommers. I reported it here:

http://issues.ez.no/IssueView.php?Id=18150&activeItem=1

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

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 10:59:17
Script start
Timing: Jan 18 2025 10:59:17
Module start 'layout'
Timing: Jan 18 2025 10:59:17
Module start 'content'
Timing: Jan 18 2025 10:59:18
Module end 'content'
Timing: Jan 18 2025 10:59:18
Script end

Main resources:

Total runtime1.1649 sec
Peak memory usage4,096.0000 KB
Database Queries58

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0048 588.1406152.6406
Module start 'layout' 0.00480.0030 740.781339.4844
Module start 'content' 0.00781.1556 780.2656549.5000
Module end 'content' 1.16340.0014 1,329.765612.1250
Script end 1.1648  1,341.8906 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.2682160.0002
Check MTime0.00130.1096160.0001
Mysql Total
Database connection0.00060.051610.0006
Mysqli_queries1.110195.2998580.0191
Looping result0.00080.0652560.0000
Template Total1.127896.820.5639
Template load0.00210.178320.0010
Template processing1.125796.634820.5628
Template load and register function0.00010.009710.0001
states
state_id_array0.00150.127710.0015
state_identifier_array0.00240.207920.0012
Override
Cache load0.00170.1492260.0001
Sytem overhead
Fetch class attribute can translate value0.00090.076920.0004
Fetch class attribute name0.00150.124940.0004
XML
Image XML parsing0.00080.064520.0004
class_abstraction
Instantiating content class attribute0.00000.000950.0000
General
dbfile0.00170.1466180.0001
String conversion0.00000.000840.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
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1content/datatype/view/ezxmltags/quote.tpldatatype/ezxmltext/quote.tplextension/ezwebin/design/ezwebin/override/templates/datatype/ezxmltext/quote.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 20
 Number of unique templates used: 8

Time used to render debug report: 0.0001 secs