Pixelpost

Authentic Photoblog Flavour


Go Back   Pixelpost Forum > DEVELOPMENT > Hacks and Modifications

Post Reply
 
Thread Tools
  #1  
Old 07-06-2006, 08:11 AM
Jondor Offline
forum loafer
 
Join Date: Jul 2006
Location: Enschede, the Netherlands
Posts: 3
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);
}
It should go directly after loading the template. In my version 1.5RC2 this is after line 165. (is there a cvs or svn repository for pp?)

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
Reply With Quote
  #2  
Old 07-06-2006, 05:39 PM
GeoS's Avatar
GeoS+ Offline
Team Pixelpost
 
Join Date: Apr 2005
Location: Warsaw, Poland
Posts: 3,613
Send a message via ICQ to GeoS Send a message via Skype™ to GeoS
I will only write this:
PHP Code:
//  Added ability to use header and footers for templates.  They are not needed but used if included in the template
if(file_exists("templates/".$cfgrow['template']."/header.html"))
    
$header file_get_contents("templates/".$cfgrow['template']."/header.html");
if(
file_exists("templates/".$cfgrow['template']."/footer.html"))
    
$footer file_get_contents("templates/".$cfgrow['template']."/footer.html"); 
__________________
photoblog | portfolio | addons | Donate
Reply With Quote
  #3  
Old 07-07-2006, 06:19 AM
raminia's Avatar
raminia+ Offline
Team Pixelpost
 
Join Date: Jan 2005
Location: FL, US
Posts: 3,706
Send a message via Yahoo to raminia
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
Reply With Quote
  #4  
Old 07-07-2006, 01:27 PM
Jondor Offline
forum loafer
 
Join Date: Jul 2006
Location: Enschede, the Netherlands
Posts: 3
Quote:
Originally Posted by raminia
As I underestood, header.html and footer.html should do what you want without modifications.
Not really.. They are special cases of a general include. In some cases good enough, in others not.
Reply With Quote
  #5  
Old 07-15-2006, 08:37 PM
virgohippy Offline
forum loafer
 
Join Date: Jul 2006
Posts: 11
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>.
Reply With Quote
  #6  
Old 07-15-2006, 10:53 PM
GeoS's Avatar
GeoS+ Offline
Team Pixelpost
 
Join Date: Apr 2005
Location: Warsaw, Poland
Posts: 3,613
Send a message via ICQ to GeoS Send a message via Skype™ to GeoS
We must rewrite whole Pixelpost and make there an order. Right now there are some ideas but in colision with other :/
__________________
photoblog | portfolio | addons | Donate
Reply With Quote
Post Reply


Thread Tools




All times are GMT. The time now is 05:18 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. | Style Design: d3 designs