hi, how i can make simple php template so i need system where i have header and footer then i can change environment (home or what will be)
PHP Template
Started by lol89, Oct 04 2009 10:22 PM
3 replies to this topic
#1
Posted 04 October 2009 - 10:22 PM
#2
Posted 04 October 2009 - 10:30 PM
Well, this is quite a broad subject that a simple search can give you alot of tutorials on. Most people use frameworks that are built for using templates, such as a content management system (PHPBB and WordPress come to mind).
Here's a most basic 'technically' a template format.
header.php
footer.php
page.php
page2.php
Basically that's all that really happens, but full on template systems have options for parsing certain tags and adding your own things to them. Take a look at PHPBB's template system and feel free to be amazed at its complexity. Or any forum software really.
Here's a most basic 'technically' a template format.
header.php
<h1>I am the header, hear me roar!</h1>
footer.php
<p>I'm the footer, at the end of the page</p>
page.php
<?php include('header.php'); ?>
<p>This is my page, and I can alter it how I want. The header and footer are independent and can be altered separately, and will not have to be changed on every single page of the site!</p>
<?php include('footer.php'); ?>
page2.php
<?php include('header.php'); ?>
<p>See I'm a second page, and changing the header or footer will reflect a change on me too! You won't have to manually edit my header or footer on every page because you changed it from one location that I am pulling it from!</p>
<?php include('footer.php'); ?>
Basically that's all that really happens, but full on template systems have options for parsing certain tags and adding your own things to them. Take a look at PHPBB's template system and feel free to be amazed at its complexity. Or any forum software really.
#3
Posted 05 October 2009 - 06:20 AM
thx man
#4
Posted 05 October 2009 - 10:19 AM
If you decide to develop something a little more complex than that, you should take a look around the p2l tutorials:
http://www.pixel2life.com/tutorials/php_co..._and_templates/
http://www.pixel2life.com/tutorials/php_co..._and_templates/
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
