[pmwiki-users] file includes for template file: reality check

Henrik Bechmann henrik.bechmann at sympatico.ca
Sat Jul 16 07:11:33 CDT 2005


Hi folks,

Just wanted to check if this is best practice.

I have some static HTML fragments that I want to include in a template 
file in association with each wiki page.

So I've generated HTML fragment files with the same body names as the 
wiki pages, and an '.incl' extension.

To include these in the template, I use the function: directive in the 
template file thus:

<!--function:loadfragment-->

Then in the config.php file for the wikifield I have

function loadfragment($theFullName) {
 $theNameArray = explode('.',$theFullName);
 $theFileName = 'includes/' . $theNameArray[1] . '.incl';
 @print fread(fopen($theFileName,"r"),filesize($theFileName));
}

Is this the best practice for such?

As an alternative, there was a tantalizing suggestion somwhere that 
there was an analog to <!--wiki:...> (wiki page includes) for file 
includes like this:

<!--file:"includes/" . $Name . ".incl"-->

but I couldn't find such.

Thanks.

- Henrik

-- 

Henrik Bechmann
www.osscommons.ca
www.bechmannsoftware.com
www.newsreader.ca (experimental)
Webmaster, www.dufferinpark.ca





More information about the pmwiki-users mailing list