place of smarty templates?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
pumuklee

place of smarty templates?

Post by pumuklee »

hi

i have a modul which uses smarty
i didnt include a new smarty class in my file because cmsms use smarty

but i want to use my smarty templates
i put this row in my php
$smarty->display("./templates/x.tpl");

but the cmsms said

Warning: Smarty error: unable to read resource: "./templates/x.tpl" in /www/http/mps/soft/webmps/wmps2_test/lib/smarty/Smarty.class.php on line 1095

so where i must put my templates?
or to solve this problem

thanks
alby

Re: place of smarty templates?

Post by alby »

pumuklee wrote: hi

i have a modul which uses smarty
i didnt include a new smarty class in my file because cmsms use smarty

but i want to use my smarty templates
i put this row in my php
$smarty->display("./templates/x.tpl");

but the cmsms said

Warning: Smarty error: unable to read resource: "./templates/x.tpl" in /www/http/mps/soft/webmps/wmps2_test/lib/smarty/Smarty.class.php on line 1095

so where i must put my templates?
or to solve this problem
Try in [CMSMS_ROOT]/tmp/templates

Alby
cyberman

Re: place of smarty templates?

Post by cyberman »

pumuklee wrote: so where i must put my templates?
Have you tried /modules/your_module/templates ?
Dee
Power Poster
Power Poster
Posts: 1197
Joined: Sun Mar 19, 2006 8:46 pm
Location: the Netherlands

Re: place of smarty templates?

Post by Dee »

pumuklee wrote: $smarty->display("./templates/x.tpl");
Put the templates inside a 'templates' folder in your module directory and use the ProcessTemplate method:

Code: Select all

$this->ProcessTemplate('xt.pl');
Regards,
D
pumuklee

Re: place of smarty templates?

Post by pumuklee »

i found the solution

im not started well with smarty module
i write $smarty = new Smarty;
instead
$smarty = new Smarty_CMS($config);

$config array contain all the config data

and from there goes
ok my template path is set in my script to point to my_module/templates

thanks for the help
Dee
Power Poster
Power Poster
Posts: 1197
Joined: Sun Mar 19, 2006 8:46 pm
Location: the Netherlands

Re: place of smarty templates?

Post by Dee »

As I explained above you don't need to create a new Smarty object.
Your module has a ProcessTemplate method, which looks in your_module/templates automatically.

There are also several methods available to use templates from the database instead of from a file, so you can make the template editable from the admin area.

Regards,
D
Locked

Return to “Modules/Add-Ons”