Page 1 of 1

Using .tpl instead og db templates?!?

Posted: Sat Mar 13, 2010 10:14 am
by jmansa
I'm currently working on altering the shop module a bit to my needs, but am having one question. How do I use the .tpl files as the templates instead of using the templates in the db records. Every time I have to change a thing in a template I have to go inside the admin and copy or edit directly from there... i want to be able to just edit in the .tpl file...

Any ideas??

Re: Using .tpl instead og db templates?!?

Posted: Sat Mar 13, 2010 10:58 am
by Peciura
Therre is module "Template Externalizer" http://dev.cmsmadesimple.org/projects/externalizer

Also you can try  using tags "{include}" or "{insert}" to use external templates. Later one is not being cached.
http://www.smarty.net/manual/en/languag ... nclude.php
http://www.smarty.net/manual/en/languag ... insert.php

Re: Using .tpl instead og db templates?!?

Posted: Sat Mar 13, 2010 11:10 am
by jmansa
Not quite... I want to replace this:

Code: Select all

$template = 'proddetail_template';
echo $this->ProcessTemplateFromDatabase($template);
With an, mayby include...

Any ideas?

Re: Using .tpl instead og db templates?!?

Posted: Sat Mar 13, 2010 11:19 am
by Jos
If you want to hack the code, I think you can use ProcessTemplate instead of ProcessTemplateFromDatabase

See: http://www.cmsmadesimple.org/apidoc/CMS ... ssTemplate

Note that it is not very wise to hack the original code regarding to future updates. You will also loose support.

Re: Using .tpl instead og db templates?!?

Posted: Sat Mar 13, 2010 11:21 am
by Peciura
Well,  in DB template paste only tag "{include ...}" that refers to optional file template :)

Re: Using .tpl instead og db templates?!?

Posted: Sat Mar 13, 2010 11:44 am
by jmansa
Jos wrote: If you want to hack the code, I think you can use ProcessTemplate instead of ProcessTemplateFromDatabase
Thanks... just what I needed... ;D

Re: Using .tpl instead og db templates?!?

Posted: Sat Mar 13, 2010 4:41 pm
by Jos
I think Peciura last suggestion is much nicer and will get you the same result but without the worry about future upgrades  ;)