Variable PHP Includes - Is there such a thing?
| From: | Freedomware | Date: | Thu, 15 Jan 2004 05:16:52 +0000 |
| Subject: | Variable PHP Includes - Is there such a thing? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-174615@lists.php.net to get a copy of this message | ||
Suppose you design a standard banner for the top of your web pages and use an include to insert it into every page on your site, like this:
<?php
include ("../../../../includes/header.php");
?>
But you later decide you'd like to change just one element on each page. For example, you might design a standard image banner, followed by a title and subtitle for each page, but you want to change the title to Alaska, Nebraska or Wyoming on each page.
Is there a way to do this with PHP? If it has a name, I can search for information online, but I don't even know what to call it.
I've played with something of this nature in Dreamweaver. You can design a template that turns out carbon copies of a page, but single out certain items by enclosing them with @@, which are somehow changed on individual pages, or something like that. I can't remember what it's called at the moment.
Another strategy would be to use a PHP include to insert an element on different pages, then modify each element with a unique style sheet on each page.
But I just wondered if PHP offers additional possibilities for similar experiments.
Thanks.