Prescol Posted December 16, 2013 Share Posted December 16, 2013 (edited) I have a tpl to my custom module frontcontroller. I need know to include a tpl file into the frontcroller tpl. Something like ...code of my frontcontroller tpl... {include file="menu.tpl"} ... more code of frontcontroller tpl I have both of the tpls in the same folder (mymodules/views/templates/front/[...]) but im not capable to make the include work. I´ve tried using the global smarty variables, and adding manually the uri. Does anyone know how could this be done? Thanks. Edited December 17, 2013 by Prescol (see edit history) Link to comment Share on other sites More sharing options...
PascalVG Posted December 17, 2013 Share Posted December 17, 2013 try to put the included tpl file in a sub folder called <folder of calling tpl file>/templates so you get this: /path/to/mymainfile.tpl /path/to/templates/myincudefile.tpl Then just use {include file='myincludefile.tpl'} inside mymainfile.tpl More info: http://www.smarty.net/docsv2/en/api.variables.tpl#variable.template.dir http://www.smarty.net/docsv2/en/template.resources.tpl Hope this helps, pascal. Link to comment Share on other sites More sharing options...
Prescol Posted December 17, 2013 Author Share Posted December 17, 2013 (edited) Thanks Pascal, but don´t work. I should have found the solution before, because getting deep in the code i saw that there is a method in the class "moduleFrontController" that retrieves the current dir of the module template. So for anyone who need it: Assign the current directory of the template to Smarty (In our module frontController) $this->context->smarty->assign('ModuleTemplateDir',$this->getTemplatePath()) Then in smarty,in our template file we use include file {include file="$base_plantilla./another.tpl"} Edited December 17, 2013 by Prescol (see edit history) 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