koha-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-devel] quoting " and ' in variables (was bugzilla #148)


From: paul POULAIN
Subject: [Koha-devel] quoting " and ' in variables (was bugzilla #148)
Date: Thu Dec 19 05:46:02 2002
User-agent: Mozilla/5.0 (X11; U; Linux i686; fr-FR; rv:1.1) Gecko/20020826

Here is the mail we exchanged in the html-template ml about " and ' in
variables.
We have to modify ALL our templates (in every languages) to do "right"
templates imho.

Stefan Seifert a écrit:

> paul POULAIN wrote:
>
>> Hi,
>> it's my 1st post here. I work on the koha project (www.koha.org) and
>> release manager, and we face a problem nobody can solve in our devel
>> list :-(((
>>
>> In the  template we have :
>> <input type="text" name="test" value="<TMPL_VAR name="test">">
>>
>> and we "replace it with the $template->param(test => $test)
>>
>> Our problem is that when $test='here is "daddy"';
>> the result is :
>> <input type="text" name="test" value="here is "daddy"">
>> which is bad html, and result in a field containing "here is"
>> ("daddy" is lost)
>> If we replace " by ' in the template, we face the same problem with
>> "it's me again".
>>
>> So, how could we solve this ?
>>
> the easiest way is to just do an
> $test =~ /"/&quot;/g;
> $template->param(test => $test);
>
> so the output would be <input type="text" name="test" value="here is
> &quot;daddy&quot;">
>
> another way is to use HTML::Templates escaping capabilities like this:
> <input type="text" name="test" value="<tmpl_var name="test"
> escape="HTML">">
> which does roughly the same  but with more translations. This should
> be the prefered solution, if you don't need extended capabilities.
>
> Stefan Seifert

--
Paul POULAIN
Consultant indépendant en logiciels libres
responsable francophone de koha (SIGB libre http://fr.koha.org)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]