Forums / General / Template warnings

Template warnings

Author Message

Peter Putzer

Saturday 03 March 2007 3:27:05 am

Since upgrading my templates to the new syntax, I get several warnings that don't seem to be critical, but which I'd nonetheless like to go away:

One is apparently caused by using {skip} exit a {foreach} loop.

Warning: eZTemplate	Mar 03 2007 12:14:31
Function "skip" is not registered

The others seem to be caused by recursive calls to a template (for different nodes of course), again in the context of a {foreach} loop. I've found an issue report which seems to have something to do with this, but according to http://issues.ez.no/IssueView.php?Id=9861&activeItem=2 it has been fixed a few months ago (I'm using 3.9.1rc1). Any ideas?

 Warning: eZTemplate:foreach	Mar 03 2007 12:14:31
Variable 'child' already exists.

Oh, and the warnings do go away if I use {section} instead.

Accessible website starting from eZ publish 3.0 (currently: 4.1.0): http://pluspunkt.at

Michael Maclean

Thursday 08 March 2007 3:27:00 am

Are you doing something like

{foreach $array as $thing}
{def $child=fetch('somethingorther')
...
{/foreach}

If you are using {def} inside a loop, that'll probably be the cause of the second warning at least. You should use {set} in cases like that where you are redefining an already-set variable.

eZpedia community documentation project | http://ezpedia.org

Peter Putzer

Thursday 08 March 2007 11:53:13 am

No, I'm using:

{foreach $array as $child}
     {recursive_call_to_the_same_template node=$child}
{/foreach}

Accessible website starting from eZ publish 3.0 (currently: 4.1.0): http://pluspunkt.at

Hans Melis

Thursday 08 March 2007 1:00:41 pm

Another possibility is that the template you're calling within the foreach loop also defines a variable $child. The included template opens in the scope of the calling template which means you can't reuse a variable name.

Hans
http://blog.hansmelis.be

Peter Putzer

Thursday 08 March 2007 1:05:34 pm

Yes, of course it does. It's a recursive call via node_view_gui. But surely {foreach} should handle recursive calls? There was a bug report, because it didn't, but that has been reported as fixed. That's why I asked in the first place.

Accessible website starting from eZ publish 3.0 (currently: 4.1.0): http://pluspunkt.at

Hans Melis

Thursday 08 March 2007 2:22:05 pm

The timeframe indeed suggests 3.9.1rc1 should contain the fix, but I'm seeing dark clouds packing above this one. I'm not familiar with this issue and I don't know the scope of it, but would you mind running your failing template with template compile enabled? Does it still fail in that case (but don't trust 1st run as that is the compiling run)?

Hans
http://blog.hansmelis.be

Peter Putzer

Thursday 08 March 2007 11:12:04 pm

It would seem that things do work, so my question was more like "Why do I get these warnings?" Although it would appear to me that my syntax was correct, I could be mistaken.

Accessible website starting from eZ publish 3.0 (currently: 4.1.0): http://pluspunkt.at

Dmitry Lakhtyuk

Tuesday 13 March 2007 9:45:24 am

it's a bug.
it's fixed in trunk(3.10.0alpha1) rev. 18361,
release/3.9.1(3.9.1) rev. 18362,
release/3.8.7(3.8.7) rev. 18363,
release/3.7.10(3.7.10) rev. 18364
release/3.6.12(3.6.12) rev. 18365

Denitsa M.

Tuesday 08 May 2007 1:28:18 am

I have a simmilar warnings, my code is something like this:

{foreach $array_vars as $var}
.................................
{foreach $variables as $Index=>$Variable}
.................................
{/foreach}
.................................
{/foreach}

and then the warnings are

Warning: eZTemplate:foreach May 08 2007 10:45:25
Variable 'Variable' already exists.

Warning: eZTemplate:foreach May 08 2007 10:45:25
Variable 'Index' already exists.

I suppose it's because the cycle is in a cycle and for each outer iteration the inner cycle variables are again used..... Is there any way to get that around? I mean, the template IS WORKING, but can i get it absolutelly warning free?

Iguana IT - http://www.iguanait.com

eZ debug

Timing: Jan 18 2025 10:36:53
Script start
Timing: Jan 18 2025 10:36:53
Module start 'content'
Timing: Jan 18 2025 10:36:54
Module end 'content'
Timing: Jan 18 2025 10:36:55
Script end

Main resources:

Total runtime1.0911 sec
Peak memory usage4,096.0000 KB
Database Queries218

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 588.7188180.8516
Module start 'content' 0.00580.8944 769.5703722.5859
Module end 'content' 0.90020.1908 1,492.1563344.4531
Script end 1.0910  1,836.6094 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00480.4421210.0002
Check MTime0.00170.1526210.0001
Mysql Total
Database connection0.00050.050110.0005
Mysqli_queries0.975789.41852180.0045
Looping result0.01121.03032160.0001
Template Total1.060397.220.5301
Template load0.00210.192520.0011
Template processing1.058296.979820.5291
Template load and register function0.00010.010110.0001
states
state_id_array0.00060.055510.0006
state_identifier_array0.00140.129420.0007
Override
Cache load0.00190.1717520.0000
Sytem overhead
Fetch class attribute can translate value0.00130.120060.0002
Fetch class attribute name0.00230.2152110.0002
XML
Image XML parsing0.00190.173160.0003
class_abstraction
Instantiating content class attribute0.00000.0026150.0000
General
dbfile0.00810.7436320.0003
String conversion0.00000.000730.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
9content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
15content/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
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 40
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs