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

H. Fox haganfox at gmail.com
Thu Aug 18 07:22:12 CDT 2005


On 18 Aug 2005 12:11:59 +1200, John Rankin <john.rankin at affinity.co.nz> wrote:
> On Thursday, 18 August 2005 10:31 AM, H. Fox <haganfox at gmail.com> wrote:
> >    global $WikiLibDirs;
> >    $PageStorePath = dirname(__FILE__).'/wiki.d/';
> >    $where = count($WikiLibDirs);
> >    if ($where>1) $where--;
> >    array_splice($WikiLibDirs, $where, 0,
> >      array(new PageStore($PageStorePath)));
> > [...]
> Perhaps have an array of locations:
> 
> function IncludePageLib($location,$recipe) {
>     $Locations = array('skin' => '$SkinDir',
>                        'cookbook' => '$CookbookDir',
>                        'local' => '$LocalDir');
>     $PageStorePath = "$Locations[$location]/$recipe/wikilib.d/\$FullName";

I'm not sure I understand, but I think you'd need to do something to
avoid "//" when $recipe is empty, wouldn't you?  Would you need to do
"global $SkinDir, $CookbookDir, $LocalDir;" too?

> I note you suggest wiki.d rather than wikilib.d -- I guess
> it doesn't matter which. I thought wikilib.d because the pages
> are part of a library of scripts and I expect they will
> include documentation pages, Site configuration pages, and
> so on. They can also get updated when a new release comes out,
> like regular wikilib.d/ pages.

Oops, a typo.  I also made another typo by leaving off \$FullName.  It
should have been this:

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

Hagan




More information about the pmwiki-users mailing list