[pmwiki-users] Inclusion of PHP file in template: $title is missing
Patrick R. Michaud
pmichaud at pobox.com
Sat May 20 09:01:44 CDT 2006
On Sat, May 20, 2006 at 11:30:18AM +0200, Felix E. Klee wrote:
>
> * If I include the file using the line
>
> <!--file:{$SkinDirUrl}/logo.php-->
>
> that does not work. In fact, as it looks, specifying a complete URL
> as path for the file seems to fail.
Right, because filenames aren't urls. A url is something that
a browser uses to locate a resource on a webserver. However, the
<!--file:...--> doesn't run from a browser, it's being processed
by the PmWiki application on the local server. Thus you need to
specify a filesystem path name, not a url.
Try <!--file:{$SkinDir}/logo.php--> instead.
> * As seen by the output of the included PHP file, the array $GLOBALS
> does not contain either of the variables $Title, $Titlespaced, or
> $FullName. Thus, I don't seem to be able to find out which page is
> currently being displayed from within the PHP file.
Despite the way they look, these aren't global variables -- they're
"page variables". For example, $Title and $FullName depend on the
page being referenced (the value of $Title in a link to SomePage is
different from the value of $Title for the current page).
Use the PageVar function, as in:
$title = PageVar($pagename, '$Title');
Pm
More information about the pmwiki-users
mailing list