Tpl direct print html in prestashop? -
i craete custom module add textarea in product backoffice . when print textarea in tpl file in print direct html link
i use print in tpl
{if isset($belvg_textarea)} <div> {$belvg_textarea|unescape:'html'} {$belvg_textarea|escape:'html'} </div> {/if}
and in module php file display
public function hookdisplayfooterproduct($params) { $id_product = tools::getvalue('id_product'); $sampleobj = belvg_sample::loadbyidproduct($id_product); if(!empty($sampleobj) && isset($sampleobj->id)){ $this->context->smarty->assign(array( 'belvg_textarea' => $sampleobj->textarea, )); } return $this->display(__file__, 'views/frontend/sample.tpl'); }
you should use nofilter
beacause prestashop 1.7 escape html default html tags displayed
in tpl file :
{if isset($belvg_textarea)} <div> {$belvg_textarea nofilter} </div> {/if}
Comments
Post a Comment