Using .tpl instead og db templates?!?

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
Post Reply
jmansa
Forum Members
Forum Members
Posts: 126
Joined: Thu Oct 19, 2006 2:46 pm

Using .tpl instead og db templates?!?

Post 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??
Peciura

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

Post 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
jmansa
Forum Members
Forum Members
Posts: 126
Joined: Thu Oct 19, 2006 2:46 pm

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

Post 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?
Jos
Support Guru
Support Guru
Posts: 4019
Joined: Wed Sep 05, 2007 8:03 pm
Location: The Netherlands

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

Post 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.
Last edited by Jos on Sat Mar 13, 2010 11:24 am, edited 1 time in total.
Peciura

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

Post by Peciura »

Well,  in DB template paste only tag "{include ...}" that refers to optional file template :)
jmansa
Forum Members
Forum Members
Posts: 126
Joined: Thu Oct 19, 2006 2:46 pm

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

Post 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
Jos
Support Guru
Support Guru
Posts: 4019
Joined: Wed Sep 05, 2007 8:03 pm
Location: The Netherlands

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

Post by Jos »

I think Peciura last suggestion is much nicer and will get you the same result but without the worry about future upgrades  ;)
Post Reply

Return to “Developers Discussion”