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

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

eZ debug

Timing: Jan 21 2025 02:46:49
Script start
Timing: Jan 21 2025 02:46:49
Module start 'content'
Timing: Jan 21 2025 02:46:49
Module end 'content'
Timing: Jan 21 2025 02:46:50
Script end

Main resources:

Total runtime0.1868 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0073 587.8438180.8125
Module start 'content' 0.00730.0047 768.656393.9453
Module end 'content' 0.01200.1748 862.6016522.8750
Script end 0.1868  1,385.4766 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00351.8882200.0002
Check MTime0.00140.7544200.0001
Mysql Total
Database connection0.00130.688810.0013
Mysqli_queries0.138874.30281410.0010
Looping result0.00140.74371390.0000
Template Total0.174593.410.1745
Template load0.00070.355410.0007
Template processing0.173893.037310.1738
Override
Cache load0.00050.251510.0005
Sytem overhead
Fetch class attribute can translate value0.00120.666910.0012
XML
Image XML parsing0.00030.138610.0003
General
dbfile0.00201.0767200.0001
String conversion0.00000.003730.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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs