Scoping Help Please

Author Message

Arran Price

Monday 14 February 2005 2:27:30 pm

Hi all,
Im having some issues with variable scoping.
The code below is used in a drop down menu where I want to pad the output with non breaking spaces. Note that I tried using pad but it only seemed to want one character and I couldnt use  . If you know how to use pad in that manner I would love to see how, but I need to understand the scoping anyway.
Im using 3.4.4 The padding_string variable is the one I need to get correctly, the frog/dog/cat etc are my testing (only frog works).

{section name=menuloop loop=$menu_items}
   {set itempadding = $padding|sub($item.object.data_map.short_name.content|count_chars)
      frog='FFFF'
   }
   
   {section name=paddingloop loop=$itempadding}
         {set menuloop:padding_string=concat($menuloop:padding_string,"B")}
         {set menuloop:cat='CCCCC'}
         {set dog='DDDDD'}
   {/section}
	<li>
	   <a href={$menuloop:item.url_alias|ezurl}>{$menuloop:item.object.data_map.short_name.content}{$menuloop:padding_string}{$menuloop:frog}{$menuloop:cat}{$cat}{$menuloop:dog}{$dog}{$paddingloop:dog}{$menuloop:paddingloop:dog}{$menuloop:paddingloop.dog}</a>
	</li>
{/section}

Any help greatly appreciated.

cheers

Arran

Arran Price

Sunday 20 February 2005 1:00:43 pm

Anyone?
Ultimately I need to take a folder name, replace any spaces with   and pad with more &nbsp up to
a certain length.
The line breaking is currently playing havoc with my drop down menu.

Arran

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 19 2025 00:10:04
Script start
Timing: Jan 19 2025 00:10:04
Module start 'layout'
Timing: Jan 19 2025 00:10:04
Module start 'content'
Timing: Jan 19 2025 00:10:05
Module end 'content'
Timing: Jan 19 2025 00:10:05
Script end

Main resources:

Total runtime0.9198 sec
Peak memory usage4,096.0000 KB
Database Queries52

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0078 587.9063152.6250
Module start 'layout' 0.00780.0036 740.531339.4297
Module start 'content' 0.01130.9068 779.9609426.7813
Module end 'content' 0.91810.0017 1,206.74228.1875
Script end 0.9198  1,214.9297 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00380.4122160.0002
Check MTime0.00150.1665160.0001
Mysql Total
Database connection0.00220.234210.0022
Mysqli_queries0.874495.0613520.0168
Looping result0.00060.0619500.0000
Template Total0.887196.420.4436
Template load0.00250.269020.0012
Template processing0.884696.174520.4423
Template load and register function0.00040.044310.0004
states
state_id_array0.00070.080010.0007
state_identifier_array0.00080.083320.0004
Override
Cache load0.00210.2286170.0001
Sytem overhead
Fetch class attribute can translate value0.00110.116410.0011
Fetch class attribute name0.00150.162220.0007
XML
Image XML parsing0.00010.014210.0001
class_abstraction
Instantiating content class attribute0.00000.001420.0000
General
dbfile0.00060.0696100.0001
String conversion0.00000.001040.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
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/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: 10
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs