Page 1 of 1

Include .tpl template inside another

Posted: Thu Feb 16, 2017 2:24 pm
by nervino
Hello,
I have a module with its .tpl templates; I want to include one of these templates inside another (both tempates are in "modules/MyModule/templates" dir). I tried with the smarty {include} without success.
Is it possible?

Thanks

Re: Include .tpl template inside another

Posted: Thu Feb 16, 2017 4:14 pm
by calguy1000

Code: Select all

{include file='module_file_tpl:MyModule;templatename.tpl}

Re: Include .tpl template inside another

Posted: Thu Feb 16, 2017 5:53 pm
by nervino
Thank you, Robert.
It works but there's a weird behaviour:
in cms page template I have:
<div class="main_container">{content}...
the included .tpl starts with:
<div class="col-md-3 left_col">
the generated html output is:
<div class="main_container"><p></p><div class="col-md-3 left_col">
I solved adding a css rule to hide the empty paragraph; not very clean but it works.

Re: Include .tpl template inside another

Posted: Tue Mar 28, 2017 11:24 am
by trice001
thanks fort that.