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.