[pmwiki-users] $PubDirUrl and $FarmPubDirUrl in recipes

Patrick R. Michaud pmichaud at pobox.com
Sun Nov 11 11:51:14 CST 2007


On Sat, Nov 10, 2007 at 07:36:30PM +0000, Hans wrote:
> Saturday, November 10, 2007, 5:15:19 PM, Patrick R. Michaud wrote:
> 
> >   SDV($WSPlusUrl,
> >     (substr(__FILE__, 0, strlen($FarmD)) == $FarmD)
> >     ? '$FarmPubDirUrl/wsplus' : '$PubDirUrl/wsplus');
> 
> > Note that both of the above use single quotes when initializing
> > the variable.  Then $FarmPubDirUrl/$PubDirUrl are substituted into
> > a generated string (via FmtPageName) when the url is actually 
> > needed in the output.
> 
> so I need to use FmtPageName on any string with $RecipeNameUrl?
> 
> how about this, it seems to work:
> 
> SDV($CommentBoxPlusUrl,
>     (substr(__FILE__, 0, strlen($FarmD)) == $FarmD)
>     ? "{$FarmPubDirUrl}/commentboxplus" : "{$PubDirUrl}/commentboxplus");

This works only as long as $FarmPubDirUrl is set before the recipe
is loaded.  For typical non-farm installations, $FarmPubDirUrl isn't
computed until skin.php gets loaded (i.e., well after config.php
is loaded), and so $CommentBoxPlusUrl would end up with '/commentboxplus'.

Pm



More information about the pmwiki-users mailing list