Page 1 of 1
Classes...
Posted: Thu Apr 15, 2004 9:50 pm
by Steveo31
Readin PHP & MySQL Web Development, and he goes through using classes for pages. Couldn't tell you really how it went, but my question is this. For pages that use the same general layout, like phpfreaks.com, would it be efficient (sp?) to use classes? Or is there another way?
Posted: Thu Apr 15, 2004 9:55 pm
by John Cartwright
I personally use a lot of classes to keep the general layout of a site.. and sub classes ... and sub sub classes.... althought there are many alternatives.. such as templating...
If you want the same layout on every page try this
template1.php
template2.php
all your contents pages.php
template1.php:
Code: Select all
<table>
<tr>
<td>
template2.php
Code: Select all
</td>
</tr>
</table>
Every other page.php
Code: Select all
<?php
include('template1.php');
echo "content here";
include('template2.php');
?>
The tables with obviously be a lot more complicated but it allows each page to have the same links, etc, etc.
This is generally frowned upon but nonetheless very efficient.
Posted: Fri Apr 16, 2004 1:36 am
by Steveo31
Wow.. that could get confusing.
So classes are "good" to use along with this method?