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

sti at pooq.com sti at pooq.com
Fri Oct 26 11:10:22 CDT 2007


Hans wrote:
> I wonder if I should employ $PubDirUrl rather than $FarmPubDirUrl for
> recipes which need some css file in a browser accessible public
> directory.
> 
> For people installing without a farm setup $FarmPubDirUrl will not
> work, unlike include_once("$FarmD/cookbook/recipe.php");
> which works regardless.
> 
> For people having  a farm setup $PubDirUrl will point to a wiki in the
> farm, and not to the farm's pub direcory.
> 
> Is there some preferred way? Some other method covering both
> eventualities? I try to get installations more automatic, and failed
> loading of a css stylesheet is not so obvious an error to see and
> correct.
> 
I ran into this exact problem recently while using fox.php. I ended up
modifying it to search for its .css files like this:

// Search path for fox.css files, if any.
SDV
  ( $FoxPubListFmt
  , array
      ( 'pub/css/fox/fox.css'        => '$PubDirUrl/css/fox/fox.css'
      , '$FarmD/pub/css/fox/fox.css' => '$FarmPubDirUrl/css/fox/fox.css'
      )
  );

# load special styles for delete button and links and for message classes
foreach((array)$FoxPubListFmt as $k=>$v)
  if (file_exists(FmtPageName($k,$pagename)))
    $HTMLHeaderFmt['fox'][] =
      "<link rel='stylesheet' type='text/css' href='$v' media='screen' />\n";




More information about the pmwiki-users mailing list