[pmwiki-users] What is the correct use of slashes
K.A.Bouton
k.a.bouton at reading.ac.uk
Mon Jul 18 10:22:32 CDT 2005
Thanks!
Katherine
> -----Original Message-----
> From: Patrick R. Michaud [mailto:pmichaud at pobox.com]
> Sent: Friday, July 15, 2005 7:04 PM
> To: K.A.Bouton
> Cc: pmwiki-users at pmichaud.com
> Subject: Re: [pmwiki-users] What is the correct use of slashes
>
>
> On Fri, Jul 15, 2005 at 02:54:37PM +0100, K.A.Bouton wrote:
> > just to make sure.
> > I understand about the backslashes and special PmWiki
> variable $FullName
> > new PageStore("$FarmD/shared.d/\$FullName")
> > uses double quotes with backslash
> $Special_PmWiki_variable($FullName)
> > is the same as
> > new PageStore('$FarmD/shared.d/$FullName')
> > uses single quote nobackslash $Special_PmWiki_variable($FullName)
> > Is there any reason to use one and not the other?
>
> Not in this instance, no.
>
> > But I don't understand how ("$FarmD and ('$FarmD are, or
> are not, the
> > same
>
> Well, technically they *aren't* the same, but in this
> instance they work out to be the same when they're ultimately
> used. With
>
> new PageStore("$FarmD/shared.d/\$FullName")
>
> the substitution of $FarmD takes place as this statement is
> executed, thus if your farm directory was "/home/user/farm"
> then the string that gets passed to the PageStore constructor
> is '/home/user/farm/shared.d/$FullName'. But with
>
> new PageStore('$FarmD/shared.d/$FullName')
>
> the substitution doesn't take place immediately -- instead,
> PmWiki's FmtPageName function replaces $FarmD with its value
> at the same time that it handles the $FullName substitution.
> Since $FarmD's value probably won't change in the interim, it
> all ends out working out to the same thing when it comes time
> to read the page store.
>
> So, in your example:
>
> > $WikiLibDirs = array(&$WikiDir,
> > 1) new PageStore("$FarmD/wiki.d/\$FullName"),
> > 2) new PageStore("$FarmD/shared.d/\$FullName"),
> > 3) new PageStore('$FarmD/wikilib.d/$FullName'));
> >
> > Shouldn't line 3) be
> > 3) new PageStore("$FarmD/wikilib.d/\$FullName"));
>
> either one works. Since $FarmD's value won't change, it
> doesn't matter if it gets substituted earlier or later.
> However, the system will probably run very slightly faster
> with the second version of #3, since it will only have to do
> the substitution of $FarmD once.
>
> Also, in general #1 should probably be omitted, unless you
> really do want the farm's wiki pages in wiki.d to be
> displayed in every field.
>
> Hope this helps!
>
> Pm
>
More information about the pmwiki-users
mailing list