Ellingsen Posted July 1, 2008 Share Posted July 1, 2008 Hi! First of all, great site! I was wondering, i've looked into some of the PHPBB files, and I notice that they use HTML template files. How do they include their PHP variabels into those files? I can see they use something like {VARIABEL_NAME} inside their files, but i cant quite figure it out. Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/112811-making-templates-with-php/ Share on other sites More sharing options...
Jaguar Posted July 1, 2008 Share Posted July 1, 2008 PHPBB uses a template engine. There are a lot of template engines available. They are not built into PHP though You have to download extra files and use them with your code. I use Smarty for my sites: http://www.smarty.net/ Quote Link to comment https://forums.phpfreaks.com/topic/112811-making-templates-with-php/#findComment-579406 Share on other sites More sharing options...
DarkWater Posted July 1, 2008 Share Posted July 1, 2008 Smarty is indeed a great templating system. You can use that, or you can try to use PHPBB's templating system which is based off of Smarty. Quote Link to comment https://forums.phpfreaks.com/topic/112811-making-templates-with-php/#findComment-579409 Share on other sites More sharing options...
Ellingsen Posted July 1, 2008 Author Share Posted July 1, 2008 Thank you very much guys, i'll look into it Quote Link to comment https://forums.phpfreaks.com/topic/112811-making-templates-with-php/#findComment-579413 Share on other sites More sharing options...
Lamez Posted July 1, 2008 Share Posted July 1, 2008 I usually take a pre made template from a free template website, or I will make my own, as if it was a html website, then I will put blocks of html code in php include to I can call the template with one include file. Quote Link to comment https://forums.phpfreaks.com/topic/112811-making-templates-with-php/#findComment-579415 Share on other sites More sharing options...
DarkWater Posted July 1, 2008 Share Posted July 1, 2008 I usually take a pre made template from a free template website, or I will make my own, as if it was a html website, then I will put blocks of html code in php include to I can call the template with one include file. But the separation of HTML and PHP is usually much easier to work with, and it makes the output template independent of the PHP code. If you need to change the way something looks with your method, it often takes a long time to rewrite it, but with templates, you just update the template and the PHP logic remains the same. Quote Link to comment https://forums.phpfreaks.com/topic/112811-making-templates-with-php/#findComment-579417 Share on other sites More sharing options...
Lamez Posted July 1, 2008 Share Posted July 1, 2008 na I have a head and a foot, and I set some variables like $login = "yes"; $path = "../../; echo '<a href="'.$path.'index.php">Login</a>'; and the php file loads the login for that page, I have had no problem yet using my method, but it is what you like best Quote Link to comment https://forums.phpfreaks.com/topic/112811-making-templates-with-php/#findComment-579419 Share on other sites More sharing options...
Wolphie Posted July 1, 2008 Share Posted July 1, 2008 Or you could alternatively use PHP's built in templating engine. <html> <head> <title><?=$website['title'];?></title> </head> <body> <? if($online) : ?> <!--Your regular page here.--> <? else : ?> <!--Website offline display message.--> <? endif; ?> </body> </html> Personally I don't mind using shorthand PHP tags when it's inside a HTML document. I don't ever declare a PHP document with them though. Also, it doesn't comply with PEAR coding standards (at least I don't think so). Quote Link to comment https://forums.phpfreaks.com/topic/112811-making-templates-with-php/#findComment-579427 Share on other sites More sharing options...
DarkWater Posted July 1, 2008 Share Posted July 1, 2008 Or you could alternatively use PHP's built in templating engine. <html> <head> <title><?=$website['title'];?></title> </head> <body> <? if($online) : ?> <!--Your regular page here.--> <? else : ?> <!--Website offline display message.--> <? endif; ?> </body> </html> Personally I don't mind using shorthand PHP tags when it's inside a HTML document. I don't ever declare a PHP document with them though. Also, it doesn't comply with PEAR coding standards (at least I don't think so). 1) Short tags make me die a little on the inside when used at all. =( 2) Smarty does it so much cleaner than that though. Quote Link to comment https://forums.phpfreaks.com/topic/112811-making-templates-with-php/#findComment-579430 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.