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.

eZ debug

Timing: Jan 29 2025 13:31:17
Script start
Timing: Jan 29 2025 13:31:17
Module start 'layout'
Timing: Jan 29 2025 13:31:17
Module start 'content'
Timing: Jan 29 2025 13:31:17
Module end 'content'
Timing: Jan 29 2025 13:31:17
Script end

Main resources:

Total runtime0.0154 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 588.2656151.2266
Module start 'layout' 0.00530.0031 739.492236.6875
Module start 'content' 0.00850.0056 776.179794.3281
Module end 'content' 0.01410.0013 870.507833.9766
Script end 0.0154  904.4844 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002717.1922140.0002
Check MTime0.00116.8519140.0001
Mysql Total
Database connection0.00074.578710.0007
Mysqli_queries0.002516.128230.0008
Looping result0.00000.089610.0000
Template Total0.00106.310.0010
Template load0.00074.818110.0007
Template processing0.00021.510310.0002
Override
Cache load0.00053.497710.0005
General
dbfile0.00159.716580.0002
String conversion0.00000.064940.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