Jump to content

[SOLVED] Include tpl in module frontcontroller


Recommended Posts

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?



Edited by Prescol (see edit history)
Link to comment
Share on other sites

try to put the included tpl file in a sub folder called <folder of calling tpl file>/templates


so you get this:




Then just use

{include file='myincludefile.tpl'}


inside mymainfile.tpl


More info:




Hope this helps,


Link to comment
Share on other sites

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)


Then in smarty,in our template file we use include file

{include file="$base_plantilla./another.tpl"}
Edited by Prescol (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...