[Pmwiki-users] file: and Variables?

Thomas -Balu- Walter list+pmwiki-users
Fri Jan 30 12:04:48 CST 2004


On Fri, Jan 30, 2004 at 11:48:52AM -0700, Patrick R. Michaud wrote:
> 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']; ?> 

Hm. I expected them to be globally defined as $ScriptUrl, but since the
file is included in a function this does of course not work :-)

> 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';

Thanks for the hint - since I am using 4.1.2 I did:

        function PrintFile($pagename, $filename)
        {
            $filetext = file($filename);
            foreach ($filetext as $line) {
                print FmtPageName($line, $pagename);
            }
        }

What kind of side-effects are you thinking of?

        Balu




More information about the pmwiki-users mailing list