I work on a website which uses an index template with a content area. A content file holds a list of variables like:
if ($page=home) include 'home.php';
then home would be pulled into the index content area.
The other way would be having a header,footer and nav bar, pulled into each page, which would be the best? Does the first way make the site any slower? As if not it's much easier to keep it that way than change all the files.
includes
Moderator: General Moderators
- harrisonad
- Forum Contributor
- Posts: 288
- Joined: Fri Oct 15, 2004 4:58 am
- Location: Philippines
- Contact:
I usually have a function named getContent() for static pages or getScript() for dynamic ones written on those includes. This I can include its contents to my HTML string.
Code: Select all
include "includes/nav_functions.php"
// ...
include "contents/home.php"
$bodystr = "
<body>
<table>
<tr><td>".getNavMenu()."</td></tr>
<tr><td>".getContent()."</td></tr>
</table>
</body>";
// ...
echo $headstr.$bodystr;