Is it possible to include a *.tpl file inside my template.html, and if yes... How?
I have tryid this:
{include file="/templates/sommerbar.tpl"}
But get this error:
string(65) "Smarty error: unable to read resource: "/templates/sommerbar.tpl""
Hope somebody can help!!!
How to include a *.tpl file in my template???
Re: How to include a *.tpl file in my template???
Did you try without the leading "/" as that starts at the root, instead of the CMSMS-root, so you might try with a relative path....
Ronny
Ronny
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: How to include a *.tpl file in my template???
Well, 1: CMS doesn't have a templates directory, so you'd have to create one
then 2: have you tried (after creating the directory above) calling {include file="something.tpl"}
then 2: have you tried (after creating the directory above) calling {include file="something.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.
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.
Re: How to include a *.tpl file in my template???
Was there any fix to this? I tryed it too and only got string(54) "Smarty error: unable to read resource: "Test_Page.tpl"" useing {include file='Test_Page.tpl'} in the templates. The folld which is located in the root named templates. Would love to see this work.
jeremyBass
jeremyBass
Last edited by JeremyBASS on Wed Jun 04, 2008 4:16 am, edited 1 time in total.
Re: How to include a *.tpl file in my template???
Hi Jeremy,
http://www.smarty.net/manual/en/api.var ... mplate.dir
You can try it to assign via user defined tag (before your include call)
Like calguy saidJeremyBASS wrote: The folld which is located in the root named templates.
/tmp/templates is not the template folder, which Smarty meanscalguy1000 wrote: Well, 1: CMS doesn't have a templates directory, so you'd have to create one
http://www.smarty.net/manual/en/api.var ... mplate.dir
You can try it to assign via user defined tag (before your include call)
Code: Select all
global $gCms;
$smarty->template_dir = $config['root_path'].'/tmp/templates';
Re: How to include a *.tpl file in my template???
Just FYI No, {include file='Test_Page.tpl'} does works, I had to move the templates folder to /tmp/templates on the root... so yes /tmp/templates isnot the template folder, which Smarty means.
Thanks for the help... have a great one...
Thanks for the help... have a great one...
Re: How to include a *.tpl file in my template???
A response from the far future. Add plugins/function.get_tpl.php:
Use:
Code: Select all
<?php
//opcache_reset();
function smarty_function_get_tpl($params, $smarty)
{
// empty($params['name']
$config = cmsms()->GetConfig();
$smarty->display($config['root_path'] . '\your_path\\' . $params['path']);
}
?>
Code: Select all
{get_tpl path=”sections\\SectionFormProduct.tpl”}
Re: How to include a *.tpl file in my template???
For the sake of clarity:
- when this thread started CMSMS had a different and more limited mechanism to handle with templates in files; This is no longer the case;
- using an UDT as suggested by Deykun is a valid possibility, but not needed nor recommended;
- the correct way to use tpl files is as follows:
- use assets\templates as the root for your templates organization;
- use any hierarchy of folders you wish, say add a common folder for example;
- if you added a top_logic.tpl template file inside the common folder, then you can call from any of your other templates:
Code: Select all
{include "common/top_logic.tpl"}
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!