[pmwiki-users] What is the correct use of slashes

Patrick R. Michaud pmichaud at pobox.com
Thu Jul 14 15:16:19 CDT 2005


On Thu, Jul 14, 2005 at 06:18:19PM +0100, K.A.Bouton wrote:
> Sorry to overwhelm the list with questions - but I am making great headway
> in understanding this and getting it all set up

Answering questions is the principal reason this list exists!  :-)

> So - using this list advice I have put this in my farm/farmconfig.php
> #1
> $WikiLibDirs = array(&$WikiDir,
>                   new PageStore("$FarmD/wiki.d/\$FullName"),
>                   new PageStore("$FarmD/shared.d/\$FullName"),
>                   new PageStore('$FarmD/wikilib.d/$FullName'));
>                   
> $group = FmtPageName('$Group', $pagename);
>     if($action == 'edit' && $group == 'Profiles') 
>       //$WikiLibDirs[] = $WikiDir;    # [ doesn't work ]
>       $WikiDir = new PageStore("$FarmD/shared.d/\$FullName");
> 
> The above works for my setup (apparently)

This looks fine.  However, I'm not sure you want that 
"$FarmD/wiki.d/\$FullName" in the $WikiLibDirs, as this generally
means that every field will display all of the pages in the farm.

> However in pmwiki it says 
> 
> #2
> WikiLibDirs = array($WikiDir, 
>       new PageStore('/path/to/shared.d/$FullName'),
>       new PageStore("$FarmD/wikilib.d/\$FullName"));
> $group = FmtPageName('$Group', $pagename);
>     if ($action == 'edit' && $group == 'Shared') 
>       $WikiDir = new PageStore('/path/to/shared.d/$FullName');

Well, hopefully you replaced the '/path/to/shared.d/...' part
of each of the above with the actual path to your shared.d file.
Using "$FarmD/shared.d" ought to work just as well for your
setup.

In PHP, the single quotes mean not to do any substitutions in
the string (in PmWiki this ends up meaning "perform the substitution
later"), while the double quotes mean to immediately substitution
the values of $-variables into the string, unless the $ is
preceded by a backslash.  '$FullName' and '$Group' are special
substitutions handled by PmWiki later when the actual pagename
is known, thus we always have to suppress their substitution
by either using single quotes for the string or preceding them
with a backslash.

Perhaps someone else on the list can come up with a clearer 
explanation -- my head seems a bit fogged at the moment.  :-|

> Is it wrong? Am I setting myself up for problems down the line?

Your #1 looks okay to me.  However, sharing pages among multiple
fields in a farm is becoming a common enough request that perhaps
we should build-in support for writable pages in shared repositories...?

Pm




More information about the pmwiki-users mailing list