|
#1
|
|||
|
|||
|
INCLUDE xx tag
Hi,
Being a programmer type of guy, the first thing I missed when starting to work on my own templates was a way to include files. In the simple templates f.e. every template has the same navigation code, but a change has to be made 3 times. Not good.. So after trying it through an addon (which doesn't work as addons are the last thing handled so included tags were ignored) I added this code to the index.php: Code:
// Handle includes before anything else.
// Gerhard Hoogterp 6 july 2006
$templates="./templates/".$cfgrow['template']."/";
while(ereg("<INCLUDE ([^>\ ]*)[\ ]*>",$tpl,$incl))
{
if (file_exists($templates.$incl[1])) $add="<!-- start include -->\n".implode(" ",@file($templates.$incl[1]))."\n<!-- stop include -->\n";
else $add="<!-- file ".$templates.$incl[1]."doesn't exists! -->";
$tpl=str_replace($incl[0],$add,$tpl);
}
After adding this code one can use <INCLUDE nav_include.html> tags in the templates which, in this case, will look for nav_include.html to include. This file should be in the same directory as the other templates. Comments and suggestions are welcome, Gerhard |
|
#2
|
||||
|
||||
|
I will only write this:
PHP Code:
|
|
#3
|
||||
|
||||
|
As I underestood, header.html and footer.html should do what you want without modifications.
__________________
Photoblog: http://pblog.raminia.com Powered by Pixelpost 1.7 |
|
#4
|
|||
|
|||
|
Quote:
|
|
#5
|
|||
|
|||
|
I haven't had any problems replacing <INCLUDED_FILE> with $included_file the way GeoS indicated. My only complaint is that <PIXEL_POST_TAGS> don't work inside the <INCLUDED_FILE>.
|
| Post Reply |
| Thread Tools | |
|
|