Jump to content
rtyrtrty

How to send a variable from the module with html tags?

Recommended Posts


If you want to send html values into the tpl file then you will have to encode the value first and decode it on tpl file.

 

Encode with - Tools::htmlentitiesUTF8()

 

Decode with - Tools::htmlentitiesDecodeUTF8()

 

 

 

Example - Let's say have some html content in a variable $var.

 

Then you will have to encode it first-: $var_to_assign = Tools::htmlentitiesUTF8($var);

 

Assign it to a tpl file like this -: $this->context->smarty->assign('var', $var_to_assign);

 

Get and decode the value in tpl file -: {$html_content = Tools::htmlentitiesDecodeUTF8($var)}

 

 

 

If it does not work you can also try this in the tpl file -: {$var nofilter}

Edited by Knowband Plugins (see edit history)

Share this post


Link to post
Share on other sites

I make this variant.

'copyright_text' => Tools::htmlentitiesUTF8(Configuration::get('copyright_text', $this->context->language->id))
{if isset($settings.copyright_text) && $settings.copyright_text}
  {Tools::htmlentitiesDecodeUTF8($settings.copyright_text)}
{/if}

Not work tags for example <strong></strong>

Edited by ken5 (see edit history)

Share this post


Link to post
Share on other sites

How to get configuration value of custom module to tpl file in theme directory?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More