Use an attribute content as a unordered parameter

Author Message

David Santiso

Wednesday 30 March 2011 12:21:55 pm

Hi,

I want to use an attribute content as a unordered parameter in a href. Firs I save the attribute content in a variable:

{set-block variable=$var}
        {attribute_view_gui attribute=$node.data_map.name}
{/set-block}

Second I put the variable in href:

<a href={concat( '/content/view/full/2/(var)/', $var )|ezurl()}>

But the resulting url is this:

http:// ... /content/view/full/2/(var)/ <!-- START: including template: design/standard/templates/content/datatype/view/ezstring.tpl (design:content/datatype/view/ezstring.tpl) --> THE STRING <!-- STOP: including template: design/standard/templates/content/datatype/view/ezstring.tpl (design:content/datatype/view/ezstring.tpl) -->

It should be a string -> THE STRING. If I show the contents of the variable, it is correct.

What is the problem?

Thanks,

David

Ivo Lukac

Thursday 31 March 2011 2:13:53 am

You have inline template debug enabled which is adding the comments

Try this:

<a href={concat('/content/view/full/2/(var)/', $node.data_map.name.content )|ezurl()}>

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Marko Žmak

Thursday 31 March 2011 6:46:44 am

Also note that you don't have to use set-block and attribute_view_gui to get the value of the attribute, you can also use $node.data_map.name.content directly like this:

<a href={concat( '/content/view/full/2/(var)/', $node.data_map.name.content|wash() )|ezurl()}>
<span style="color: #66cc66;" mce_style="color: #66cc66;">{</span><a target="ez_no_documentation" href="http://doc.ez.no/attribute_view_gui" mce_href="http://doc.ez.no/attribute_view_gui"><span style="color: #0600FF;" mce_style="color: #0600ff;">attribute_view_gui</span></a> <span style="color: #007700;" mce_style="color: #007700;">attribute</span><span style="color: #66cc66;" mce_style="color: #66cc66;">=</span><span style="color: #0000bb;" mce_style="color: #0000bb;">$node</span>.<span style="color: #006600;" mce_style="color: #006600;">data_map</span>.<span style="color: #006600;" mce_style="color: #006600;">name</span><span style="color: #66cc66;" mce_style="color: #66cc66;">}</span>

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

David Santiso

Thursday 31 March 2011 11:13:44 am

Thank you very much ;)

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 30 2025 19:32:44
Script start
Timing: Jan 30 2025 19:32:44
Module start 'layout'
Timing: Jan 30 2025 19:32:44
Module start 'content'
Timing: Jan 30 2025 19:32:44
Module end 'content'
Timing: Jan 30 2025 19:32:44
Script end

Main resources:

Total runtime0.0244 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0047 588.2656151.2266
Module start 'layout' 0.00470.0043 739.4922220.7422
Module start 'content' 0.00900.0138 960.23441,002.0703
Module end 'content' 0.02280.0015 1,962.304733.9766
Script end 0.0244  1,996.2813 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002610.5388140.0002
Check MTime0.00114.5236140.0001
Mysql Total
Database connection0.00072.729210.0007
Mysqli_queries0.00249.754430.0008
Looping result0.00000.119210.0000
Template Total0.00114.710.0011
Template load0.00083.273310.0008
Template processing0.00031.389010.0003
Override
Cache load0.00052.098210.0005
General
dbfile0.00156.016280.0002
String conversion0.00000.029340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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