[pmwiki-users] Q: preferred way to include wiki pages with recipes

H. Fox haganfox at gmail.com
Wed Aug 17 17:31:42 CDT 2005


On 18 Aug 2005 09:45:26 +1200, John Rankin <john.rankin at affinity.co.nz> wrote:
> A list discussion a while ago covered the question of how to
> distribute wiki pages with a skin. Could I get confirmation
> that the following is the recommended approach for recipes:
> 
> 1. place the pages into cookbook/recipe/wikilib.d/
> 
> 2. include the following code fragment
> 
> function ActivateRecipePageLib($recipe) {
>   global $WikiLibDirs;
>   $where = count($WikiLibDirs);
>   if ($where>1) $where--;
>   array_splice($WikiLibDirs, $where, 0,
>     new PageStore("cookbook/$recipe/wikilib.d/\$FullName"));
> }

Excellent question.

> The function should probably be generalised so 'cookbook'
> and 'wikilib.d' are variables.

Having a core function is a good idea, but maybe it would be easier /
more reliable / less ambiguous  to do

    global $WikiLibDirs;
    $PageStorePath = dirname(__FILE__).'/wiki.d/';
    $where = count($WikiLibDirs);
    if ($where>1) $where--;
    array_splice($WikiLibDirs, $where, 0,
      array(new PageStore($PageStorePath)));

in the recipe script or skin.php script.

Is

   $PageStorePath = dirname(realpath(__FILE__)).'/wiki.d/';

an improvement, or does realpath() make any difference?

Hagan




More information about the pmwiki-users mailing list