[Pmwiki-users] file: and Variables?

Patrick R. Michaud pmichaud
Fri Jan 30 11:48:57 CST 2004


On Fri, Jan 30, 2004 at 07:13:09PM +0100, Thomas -Balu- Walter wrote:
> I just stumbled upon the fact that I can not just use variables like
> $ScriptUrl, $PageUrl or $DefaultGroup in files that were included using
> file: - e.g.
> 
> $PageFooterFmt = 'file:local/PageFooterFmt.html';
> 
> It looks like they are not even set as PHP variables. Is there a
> function to replace them in the included files? 

Not really.  Thus far the best way I know to do this is something
along the lines of

   $PageFooterFmt = 'file:local/PageFooterFmt.php';

and then inside of PageFooterFmt.php you can do

   <?php echo $GLOBALS['ScriptUrl']; ?> 

or

   <?php echo FmtPageName('$ScriptUrl',$pagename); ?>

whenever you need access to those substitutions.

OTOH, I might explore creating a special 'fmt:local/PageFooterFmt.html'
feature that performs $-substitutions on the contents of the filename
that follows.  This might produce some unintended side effects, however.
In the meantime, you could always implement your own version of this
in local.php with something like:

   function PrintFile($pagename,$filename) {
     $filetext = file_get_contents($filename);          # PHP >= 4.3.0
     print FmtPageName($filetext,$pagename);
   }

   $PageFooterFmt = 'function:PrintFile local/PageFooterFmt.html';

Pm



More information about the pmwiki-users mailing list