View Full Version : including php in .tpl files

Dec 24th, 2008, 07:55 PM
As some of you may know, I have had a script written by a friend. Most of the way the design of the site/script is displayed in .tpl files. Which makes it a pain in the butt to create new .tpl files, since I can't include php in them, or don't know how. Which will lead to me creating/doing the same thing several times which is a waste of time.

anyways, how do I include php in a .tpl file? I have tried using regular php includes, {php} include etc. no success.

Dec 24th, 2008, 10:29 PM
That would depend on how the .tpl files are parsed by the application. Are these .tpl files used by a template system (such as Smarty) or by some custom mechanism written as part of the application?

Dec 24th, 2008, 11:07 PM
I honestly don't know. Is there a way to tell? I know there are several other files, including classes (which are php files) etc. The guy who coded the script, is never online anymore, so I can't ask him.

Dec 24th, 2008, 11:13 PM
If you installed it, you would probably know if it uses a third-party template system since you'd have installed that separately.

Other than that, the only way would be to examine the code.

Dec 24th, 2008, 11:16 PM
I installed it. I didn't have to install anything to do with smarty, so I would assume that he wrote these template files into the code himself.

Dec 24th, 2008, 11:49 PM
Yeah, sounds like it. Then you'd have to examine the code to determine how it is parsing the .tpl files

Dec 24th, 2008, 11:53 PM
What exactly am I looking for? I have never dealt with .tpl files so this is all like learning how to speak spanish or something to me. lol

I can post the code of template files if need be. or pm you it.