What I’m trying to achieve is build a simple and lightweight theme engine, where anyone will be able to create his own template easily, I have managed to do this using PHP, and for example, if someone wants to input the logo, all they have to do is use: {logo} , and etc.
The template files extensions are ‘.inc’.. My problem is, i don’t know how to allow users to still execute php code, using PHP (< ?php ?>) tags.
I have tried both adding this in my htaccess:
AddType application/x-httpd-php .inc
I know other template engines exist, such as smarty, but id rather go for something a lot more simpler.
Not too many people will be happy to use a template engine which requires adding new web server handlers to use it.
Therefore it would be advisable to use a standard fully supported extension like .php instead of .inc or in case you are really willing to use .inc simply include the file with output buffering turned on and collect the output in a variable like this:
$contentwill hold whatever was insidetemplate.incso you can do whatever you want with it.Not only that but if your
template.incfile contains PHP variables they will be parsed too.