Tpl and string output problem in html tag.

Author Message

Stefano Gattuso

Monday 11 July 2011 7:54:40 am

Hello to evrybody... I have a little problem , I want put a varibale into an html tag but if the variable have space inside I have a weird result... let me make an example for explain better

 

 {def $x="first second"}
 

<input type="text"  name="a" value={$x}>


the result is:

<input type="text"  name="a" value="first" second="">


inestead of:


<input  type="text"  name="a" value="first second">

some one can help me?sorry for my bad english .. thanks
i did try with wash and other...but not result.... how i can solve this problem?

[ ] http://www.buby.it

Nicolas Lescure

Monday 11 July 2011 8:54:24 am

Strange. So strange I just tried.

Never believe "inspect element" of your browser.

Look at the whole sourrce, and you'll see the expected result.

<input type="text"  name="a" value=first second>

{* You need that : *}

<input type="text"  name="a" value="{$x}">

Stefano Gattuso

Monday 11 July 2011 12:06:58 pm

well u true :) i just miss the double qoute XD sorry i feel so dummy XD

[ ] http://www.buby.it

André R.

Tuesday 12 July 2011 12:31:17 am

Also make sure you use wash operator on all output, it will make sure quote's are escaped and same with html.

As in:

<input type="text"  name="a" value="{$x|wash()}">

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.