[pmwiki-users] How do I get the Group for the current page inside of my php function for a markup?

H. Fox haganfox at users.sourceforge.net
Mon Sep 5 15:00:31 CDT 2005


On 9/5/05, Chris Cox <ccox at airmail.net> wrote:
> I'm lost... I have no idea how a piece of php code is supposed
> to know the Group of the page being loaded that contains the
> markup being executed.
> 
> All of the function that seem that they might deal with this
> contain multiple parameters and I can't get anything to do
> what I want.
> 
> here's what I want...
> 
>  From inside of my PHP code... I want to include a page
> ONLY if it exists:
> 
> I'm writing this in psueod code here so as to not confuse
> you with the myriad of pmwiki function names (don't want
> to lead you into using something):
> 
> IF (PAGE_EXISTS("Groupname.Pagename"))
>         INCLUDE "Groupname.Pagename"
> ENDIF
> 
> I'm generating the Pagename part... but how do I get
> the Group?  I know in markup I can use {$Group}, but
> is there something in PHP land I can use??

$pagename is the equivalent of {$Group}.{$Name} in markup, so if you do

    $page_array = explode('.',$pagename);

$page_array['0'] is the the equivalent of {$Group} in markup.
$page_array['1'] is the equivalent of {$Name} in markup.

This is how I do it in light.php.  There's probably a better way...

Hagan




More information about the pmwiki-users mailing list