Include .tpl template inside another

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Locked
nervino
Power Poster
Power Poster
Posts: 448
Joined: Sun Dec 28, 2008 12:15 pm
Location: Roma, Italy

Include .tpl template inside another

Post 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
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Include .tpl template inside another

Post by calguy1000 »

Code: Select all

{include file='module_file_tpl:MyModule;templatename.tpl}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
nervino
Power Poster
Power Poster
Posts: 448
Joined: Sun Dec 28, 2008 12:15 pm
Location: Roma, Italy

Re: Include .tpl template inside another

Post 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.
trice001
New Member
New Member
Posts: 1
Joined: Tue Mar 28, 2017 11:19 am

Re: Include .tpl template inside another

Post by trice001 »

thanks fort that.
Locked

Return to “Developers Discussion”