[pmwiki-users] $Group, $Name in Markup definition

tamouse mailing lists tamouse.lists at gmail.com
Fri Mar 9 13:39:05 CST 2012


On Mon, Feb 13, 2012 at 8:53 AM, DaveG <pmwiki at solidgone.com> wrote:
> On 2/13/2012 4:05 AM, Anton Shevtsov wrote:
>> How i can access to $Group, $Name variable from custom Markup?
>>
>> example:
>>
>> Markup("get_content", "directives",
>> '/\(:get_content\s+\((.+?)\):\)/e',"_get_content($1)");
>> .....
>> .....
>> function _get_content($filename)
>> {
>> $foo=file_get_contents($mypath.$Group.'/'.$Name.'/'.$filename);
>> return $foo;
>> }
>
> Using global:
> function _get_content($filename)
> {
> global $Name;
>
> $foo=file_get_contents($mypath.$Group.'/'.$Name.'/'.$filename);
> return $foo;
> }

You should also include $Group (and possibly $mypath) in that global
declaration. Check the following in the php manual:

 < http://us.php.net/manual/en/language.variables.scope.php >



More information about the pmwiki-users mailing list