All pastes #937547 Raw Edit

Untitled

public text v1 · immutable
·published 2008-03-11 01:19 UTC
rendered paste body
PHP Code:
<?php

$navigation = "HTML NAVIGATION HERE";

?>


Now our navigational bar is declared as the variable $navigation in global.php.
So now on index.php and links.php (all for example) we have:
PHP Code:

<?php

require_once "global.php";

echo '
HTML PAGE CONTENT HERE'.$navigation.'REST OF PAGE CONTENT';

?>


And $navigation is read in index.php and links.php from calling "require_once "global.php" ".
You can do page headers, navigation, footers and anything else in this fashion, so you don't have to keep editing it in each file. That's the way I do it, at least. And say, I wanted to make a new page called "howtos.php" and add a link to the navigation. Instead of editing index.php and links.php's navigation bar, I can edit the variable in global.php and it changes on both files, with only one edit 

Dr Small