index.php
<?php $title = 'P2L - Koncept'; $template = 'P2'; $content = 'Hello World!'; $admin = false; include("templates/$template/index.php"); ?>templates/P2/index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title><?= $title; ?></title> </head> <body> Well here is my content<br /> <?= $content; ?><br /> <?php while($i < 11){ ?> Test <?= $i; ?><br /> <?php $i++; } ?><br /> <?= if($admin) ? 'I am admin' : 'I am not an admin'; ?> </body> </html>lets explain the code above
<?= $title; ?>is the same as
<?php echo $title; ?>
<?= if($admin) ? 'I am admin' : 'I am not an admin'; ?>Is a if statement, if $admin is true it will echo "I am admin" else "I am not an admin"
<?php while($i < 11){ ?> Test <?= $i; ?><br /> <?php $i++; } ?>Is just a while loop that loops trough the html it surrounds
Sorry for lack of explanation, i hope i left enough examples for you guys.
Better tutorials to come when im not sick.
Edited by Koncept, 04 May 2006 - 11:35 PM.