is this a bug or i'm doing something bad?

Author Message

luis muñoz

Tuesday 08 August 2006 8:19:16 am

Hi,

I have the following problem:
If i add this code to one template included from another template:

things....
{set $counter=0}
{do}
{set $counter=inc( $counter )}
many things...
{/do while ne( $counter, $auxactualnode.depth|abs )}

The code works prefectly

But if i include two or more templates from the same template with this code in it breaks. Drops timeout after 180 seconds of 100 mysql load. This happends in 3.7 and 3.8.

But if i replace the do loop with a foreach

things...
{foreach $auxactualnode as $xxx}
many things...
{/foreach}

Then everything works perfectly.

Is this a bug in the do function?

Thanks
Luis

Claudia Kosny

Saturday 12 August 2006 6:04:49 pm

Hi Luis,

it works fine for me (Ez 3.7.5 and 3.8.1).
If you want to go to the root of it I would try some of the following:
Make sure that $counter is defined all the times. Maybe you undef it after including the first template with this code so that during the second call of this loop there is no counter to set and thus the while condition never evaluates to true.

If this is not the problem, try to see what values the counter has in each iteration. To do that print the counter in each iteration and add a conditional {break} within the loop, something like this:

{if is_set($counter)|not}
 {def $counter=0}
{/if}
{set $counter=0}
{do}
 {set $counter=inc( $counter )}
 counter is set to {$counter} <br />
 {if $counter|gt(20)}
   breaking {$counter}
   {break}
 {/if}
{/do while ne( $counter, 10)}

Claudia

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 21 2025 06:12:01
Script start
Timing: Jan 21 2025 06:12:01
Module start 'layout'
Timing: Jan 21 2025 06:12:01
Module start 'content'
Timing: Jan 21 2025 06:12:02
Module end 'content'
Timing: Jan 21 2025 06:12:02
Script end

Main resources:

Total runtime1.7282 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0075 589.1641151.2266
Module start 'layout' 0.00750.0040 740.390636.6797
Module start 'content' 0.01151.7151 777.0703488.8516
Module end 'content' 1.72660.0015 1,265.92197.8125
Script end 1.7282  1,273.7344 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.2092160.0002
Check MTime0.00150.0857160.0001
Mysql Total
Database connection0.00120.072010.0012
Mysqli_queries1.675796.9627540.0310
Looping result0.00060.0362520.0000
Template Total1.687997.720.8440
Template load0.00210.124120.0011
Template processing1.685897.544320.8429
Template load and register function0.00020.014410.0002
states
state_id_array0.00110.066310.0011
state_identifier_array0.00220.128520.0011
Override
Cache load0.00170.1005230.0001
Sytem overhead
Fetch class attribute can translate value0.00390.227920.0020
Fetch class attribute name0.00190.111820.0010
XML
Image XML parsing0.00040.022520.0002
class_abstraction
Instantiating content class attribute0.00000.000520.0000
General
dbfile0.00130.0743100.0001
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
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 18
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs