Forums / Setup & design / Using "attribute_view_gui" with the 'break' function
Cam McVey
Friday 30 January 2004 7:48:19 am
I'm desparate - I cannot seem to find an example of how to use the 'break' function with "attribute_view_gui". Here's some code:
<p id="story_intro">{attribute_view_gui attribute=$node.object.data_map.story_intro"}</p>
There are lots of new lines in the entered text when the story was submitted earlier. What code would I use to make these new lines into html break tags (e.g., <br /> )?
Thanks for any help!
Monday 02 February 2004 6:08:26 am
Nobody got any bright ideas? I'm really stuck here!
attribute_view_gui seems to only want an object, not a string, so there doesn't seem to be any way to pipe the value to the 'break' function and then have it be displayed.
Any help given would be really appreciated.
Balazs Halasy
Monday 02 February 2004 7:28:53 am
There are two ways of showing content:
1) Showing it using the attribute's view template2) Showing it directly
You're doing number one. What happens there is that eZ publish inserts another template where you call the "attribute_view_gui" function. Instead, you could do something like this:
"$node.object.data_map.story_intro.content"
This will return the string that is stored in that attribute. Now, you could simply pipe that string into whatever operator you want. See? (PS: If story_intro is XML text then you would have to do append a ".content.output.output_text" to the attribute. If story_intro is only text/text-line then .content is enough.)
Cheers..
Balazs
Monday 02 February 2004 7:53:21 am
Perfect! This did exactly what I wanted:
<p id="story_intro">{$node.object.data_map.story_intro.content | break}</p>
Thank you very much!