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.