Jump to content

How to insert raw HTML into tpl files without being escaped?


wolic2

Recommended Posts

Hi,

Using paypal module as an example, if i edit the .tpl directly like this:

<img src="https://test.com?order_id={$order.id_order|intval}&amount={$price|replace:'$ ':''}" />

The URL on frontpage would become:

<img src="https://test.com?offer_id=1234&amp;amount=0.01">

which is destroying the URL by escaping the ampersand symbol.

I have tried multiple ways doing it, including:

Controller:
$this->context->smarty->assign('ampHtml', rawurlencode("&"));

.tpl:
{$ampHtml|escape:'html':'UTF-8'|htmlspecialchars_decode:3}

- and all sorts of encoding and decoding I can find on Google (e.g. tools::encode in Controller & tools::decode in .tpl) but it is still escaping the & symbol!

How can I create a proper URL with GET parameters in .tpl or in controller? Appreciate the assistance, been figuring this for the past 2 hours but futile.

I am using PS 1.6.1.24 and working on paypal module

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...