Hi All,
Please help me to understand it better. I want to have a simple site with Header, navigation bar, side bar and opposite to side bar, main contents. I want to Include files for this sections in index.php. Here is a thing I dont understand:

---- If I divide index.php using table, how do I make other pages? Should them be full XHTML starting or just simple <div> ----

Thanks for your valuable reply

The file is included inline and parsed just like the contents of the file would be if they were placed there instead. A standard include for the content could be something like:
content.php:

<div class="content">
<?php echo $content;?>
</div>

Then the page could be something like:

<?php
//query db and populate $content variable here.
?>
<html>
<head><title>Page</title></head>
<body>
<?php include "content.php";?>
</body>
</html>

The above would display the same output as:

<?php
//query db and populate $content variable here.
?>
<html>
<head><title>Page</title></head>
<body>
<div class="content">
<?php echo $content;?>
</div>
</body>
</html>

You should also consider using includes for things that are common throughout the site, like the navigation menu. This way, if you have 50 pages on the site and you want to add a link to the navigation menu, you only have to change one file, instead of 50.

each included file can be only that part of the html that they need to be
full xhtml for all will give validation errors

<?php
include('doctype.inc.php'); 
echo '<title>'.$pagetitle."</title>";
include('header.inc.php');
include('menu.inc.php');
include("$pagename");
include('footer.inc.php'); ?>

is valid as long as the included files contain the required html (or php to generate the required html obviously) in the required order
there is no requirement for those filenames, that is the code for the dynamic pages of my site
at the end of the day it appears to be a full tree-optimised structure that works well SEO, There is a mod_rewrite rule that displays
mysite.com/folder/file
from
dynamic.php?filename

commented: We must have posted at the exact same time. Good explanation. +4

That is a good lecture guys!
Thanks alot

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.