newbie problems with fetch

Author Message

Carlos Campderrós

Saturday 29 July 2006 10:42:19 am

Hi all,

I'm just starting my first project with eZpublish, and just facing my first problem. I want to fetch the latest "Release_middleware" object stored on the "releases" folder (Node ID == 60). Here is the full code of my "sidebar_releases.tpl" template, called from "full_view_portada.tpl", an override from the full view template:

{let children=fetch('content', 'list', hash (
    'parent_node_id', '60',
    'limit', 1,
    'class_filter_type', 'include',
    'class_filter_array', array('Release_middleware')
 ) )
}

<h1>foo</h1>

{section name=Child loop=$children}
    <h2>bar</h2>
{/section}
{/let}

But I get an error:

Error: eZTemplate:let  	Jul 29 2006 12:34:21

parser error @ design/foobar/templates/sidebar_releases.tpl:4
Empty variable name at [('content', 'list', hash ( 
	'parent_node_id', '60',
	'limit', 1,
	'class_filter_type', 'include',
	'class_filter_array', array('Release_middleware')
 ) )
]

I'm stuck with this problem for the last two hours, I can't find a solution. Any help out there?

Kristian Hole

Saturday 29 July 2006 11:27:04 am

Hi Carlos,

Welcome to the forum!

For some reason eZ publish is picky about having a space between the functions and (. I think you get this error because you have a space between hash and (.

Btw, you can also write this in the "new" template syntax introduced in 3.5. Like this:

{def $children=fetch('content', 'list', hash(
   'parent_node_id', '60',
   'limit', 1,
   'class_filter_type', 'include',
   'class_filter_array', array('Release_middleware')
 ) )
}

<h1>foo</h1>

{foreach $children as $child}
   <h2>bar {$child.name}</h2>
{/foreach}

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

Carlos Campderrós

Saturday 29 July 2006 1:00:13 pm

Oh yes, that space was the problem. Thank you very much Kristian : )

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

Main resources:

Total runtime0.0172 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0062 587.9141152.6250
Module start 'layout' 0.00620.0035 740.539139.4453
Module start 'content' 0.00970.0052 779.984489.3516
Module end 'content' 0.01490.0020 869.335934.3047
Script end 0.0169  903.6406 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.003117.9651140.0002
Check MTime0.00116.4500140.0001
Mysql Total
Database connection0.00095.159210.0009
Mysqli_queries0.002715.515030.0009
Looping result0.00000.116310.0000
Template Total0.00169.210.0016
Template load0.00084.752010.0008
Template processing0.00084.462510.0008
Override
Cache load0.00053.155110.0005
General
dbfile0.00052.689780.0001
String conversion0.00000.052640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs