Forums / Setup & design / Why this code does not work?

Why this code does not work?

Author Message

Daniele Nocentini

Tuesday 15 March 2005 8:56:44 am

I want to display the node name of a specific node, my code is this:

{switch name=Sw1 match=$node.object.section_id}
{case match=6}
{let children=fetch(content,node,hash(node_id,98))}{$children.data_map.name.content|upcase}{/let}
{/case}
{/switch}

I can enter inside the case of the swith but don't show me the node name.

Antica Bottega Digitale srl
http://www.abd.it

Łukasz Serwatka

Tuesday 15 March 2005 9:21:26 am

{switch name=Sw1 match=$node.object.section_id}
    {case match=6}
        {let children=fetch(content,node,hash(node_id,98))}
            {$Sw1:children.data_map.name.content|upcase}
         {/let}
    {/case}
{/switch}

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Hans Melis

Tuesday 15 March 2005 9:26:36 am

With the <i>name</i> attribute in the switch-tag, you open a new namespace. All variables declared inside the namespace must be referenced with the namespace as part of the variable name. The general form is {$namespace:myvariable}, where <i>namespace</i> can consist of several nested namespaces. To reference the current (active) namespace, you can also use {$:myvariable}. (More info: http://ez.no/ez_publish/documentation/development/libraries/ez_template/basics/namespaces)

In your case, it would be: {$Sw1:children.data_map.name.content} or {$:children.data_map.name.content}.

But I would suggest to get rid of the <i>name</i> parameter. It's not needed and makes things more complicated than they should be.

hth

Edit: Lukasz didn't elaborate as much and beat me to it...

Hans
http://blog.hansmelis.be

Łukasz Serwatka

Tuesday 15 March 2005 9:45:30 am

Yep, I agree with Hans, this was to fast...

Daniele, more about Namespaces with code example you can find here.
http://ez.no/ez_publish/documentation/development/libraries/ez_template/basics/namespaces

But Hans wrote summary as well ;-)

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Daniele Nocentini

Wednesday 16 March 2005 12:00:58 am

Yes now it work fine, thank you very much!

Antica Bottega Digitale srl
http://www.abd.it

eZ debug

Timing: Jan 19 2025 21:31:03
Script start
Timing: Jan 19 2025 21:31:03
Module start 'content'
Timing: Jan 19 2025 21:31:05
Module end 'content'
Timing: Jan 19 2025 21:31:05
Script end

Main resources:

Total runtime1.4623 sec
Peak memory usage4,096.0000 KB
Database Queries202

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0117 588.9531180.8359
Module start 'content' 0.01171.2986 769.7891612.6016
Module end 'content' 1.31030.1520 1,382.3906337.3750
Script end 1.4623  1,719.7656 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00450.3048210.0002
Check MTime0.00160.1063210.0001
Mysql Total
Database connection0.00340.233510.0034
Mysqli_queries1.375894.07852020.0068
Looping result0.00230.15662000.0000
Template Total1.412596.620.7062
Template load0.00260.176420.0013
Template processing1.409996.413220.7049
Template load and register function0.00010.005610.0001
states
state_id_array0.00260.177210.0026
state_identifier_array0.00170.118620.0009
Override
Cache load0.00190.1297260.0001
Sytem overhead
Fetch class attribute can translate value0.00160.106140.0004
Fetch class attribute name0.00110.076180.0001
XML
Image XML parsing0.00160.108240.0004
class_abstraction
Instantiating content class attribute0.00000.0011100.0000
General
dbfile0.00550.3780400.0001
String conversion0.00000.000530.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
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/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: 21
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs