KenFranklin Posted February 13, 2017 Share Posted February 13, 2017 How to send a variable from the module with html tags? I pass the variable, and it shows <p></p>. Link to comment Share on other sites More sharing options...
Knowband Plugins Posted February 13, 2017 Share Posted February 13, 2017 (edited) 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 February 20, 2017 by Knowband Plugins (see edit history) Link to comment Share on other sites More sharing options...
KenFranklin Posted February 13, 2017 Author Share Posted February 13, 2017 (edited) You you are right. Thank you. I use in module - Tools::htmlentitiesUTF8(), and how right to decode in *.tpl? Edited February 13, 2017 by ken5 (see edit history) Link to comment Share on other sites More sharing options...
Knowband Plugins Posted February 13, 2017 Share Posted February 13, 2017 You can use the same function as in your PHP files, the syntax will only change, nothing else. {$decoded_var = Tools::htmlentitiesDecodeUTF8($variable)} Link to comment Share on other sites More sharing options...
KenFranklin Posted February 13, 2017 Author Share Posted February 13, 2017 {$decoded_var = Tools::htmlentitiesDecodeUTF8($variable)} - use in smarty? Link to comment Share on other sites More sharing options...
KenFranklin Posted February 13, 2017 Author Share Posted February 13, 2017 (edited) 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 February 13, 2017 by ken5 (see edit history) Link to comment Share on other sites More sharing options...
Knowband Plugins Posted February 13, 2017 Share Posted February 13, 2017 (edited) Try this {$settings.copyright_text|@html_entity_decode} Edited February 13, 2017 by Knowband Plugins (see edit history) Link to comment Share on other sites More sharing options...
KenFranklin Posted February 13, 2017 Author Share Posted February 13, 2017 Not work. May be you have another variant. Link to comment Share on other sites More sharing options...
Geo Burlibasa Posted February 14, 2017 Share Posted February 14, 2017 {$var nofilter} Link to comment Share on other sites More sharing options...
KenFranklin Posted February 14, 2017 Author Share Posted February 14, 2017 Yes, it works, thank you! Link to comment Share on other sites More sharing options...
ican Posted February 14, 2019 Share Posted February 14, 2019 How to get configuration value of custom module to tpl file in theme directory? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now