unknown tag “l” in smarty prestashop

五迷三道 提交于 2019-12-11 09:15:34

问题


We are developing a module in prestashop. At a place, we need to define new smarty object to create and fetch new template. This is working fine but when we using language variable in that custom smarty template then its giving us error for unknown tag "l" in tpl file. Below are code in which we are getting error:

In module controller:

class MymoduleTestModuleFrontController extends ModuleFrontController
{  
   function initContent(){  
        $this->context->smarty->assign('temp', $this->test());
        $this->setTemplate('mymodule.tpl);
   }  

   function test(){
        $custom_smarty = new Smarty();
        $custom_smarty->setTemplateDir(_PS_MODULE_DIR_.'mymodule/views/templates/front/product');  
        $tpl = $custom_smarty->createTemplate('informations.tpl');  
        return $tpl->fetch();
   }
}

In mymodule.tpl:

<div>  
   {$temp|escape:''}
</div> 

In information.tpl:

<span class="kblabel ">{l s='Name' mod='mymodule'}</span><em>*</em>

Now the system is giving us following error

Fatal error: Uncaught --> Smarty Compiler: Syntax error in template "/var/www/html/prestashop/modules/mymodule/views/templates/front/product/informations.tpl" on line 12 "<span class="kblabel ">{l s='Name'     mod='mymodule'}</span><em>*</em>" unknown tag "l" <-- thrown in /var/www/html/prestashop/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 12  
We dont know, why we are getting this error? this error dont comes  if we directly put the html of "information.tpl" into "mymodule.tpl".  

来源:https://stackoverflow.com/questions/31990153/unknown-tag-l-in-smarty-prestashop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!