Jump to content

Language unescape html - Validator Problem


Poppy381

Recommended Posts

Hi,

 

Here is the solution to replace special characters in a TPL translation. For example if you have a special character like   (non-breaking space) in your string. In my case I replace white spaces by insecable spaces for prices.

 

 

{l s='The product price is %s' sprintf='1 000 €.' mod='yourmodulename'}

 

 

It displays The product price is 1 000 €.

 

Of course it is not what we want. Here is the solution :

 

{capture name='condition'}
{l s='The product price is %s' sprintf='1 000 €.' mod='yourmodulename'}
mod='crowdfunding'}
{/capture}
{assign var='condition_1' value=$smarty.capture.condition}
 
{$condition_1|unescape:'html'}

 

 

Hope you enjoy my solution by using capture smarty function :).

Edited by Poppy381 (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 4 months later...

Hi,

 

As now, yes, unescape is forbiden. :-/

 

And, as you know, if you escape in html some Smarty vars wich contains html content, you will have some problems in you display.

 

So, you need to do nothing about this var !

 

But, to pass the validation, you will need to assign your var with the _html suffix and use it like {myvar_html}.

You will, of course, have the error in the validator but the manual validation by the team will pass if they can see that :)

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...

My module has been refused with this method. Here is the comment of a Validator :

 

If you have some HTML content, use a comment on the same line {*HTML CONTENT*}

 

 

Original message in French :

 

Si vous avez du HTML, préférez utiliser un commentaire sur la même ligne {* HTML CONTENT *}

Cordialement,

Emmanuel
Service Client - PrestaShop Addons

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...