[pmwiki-users] Ingredients . . .

H. Fox haganfox at users.sourceforge.net
Mon Feb 6 23:32:13 CST 2006


On 2/5/06, christian.ridderstrom at gmail.com
<christian.ridderstrom at gmail.com> wrote:
> On Sat, 4 Feb 2006, Ben Wilson wrote:
>
> > That said, I've scripted a few recipes and tinkered with a few more.
> > I've noticed certain bits of code are used repeatedly throughout
> > various recipes. I would invite the community to cull through the code
> > and find which routines are more commonly used and may be worth
> > pulling out of individual recipes and turned into "ingredients." I
> > think so doing would reduce the size of code, improve the authoring of
> > new code, and produce more maintainable recipes overall.
>
> This sounds like an excellent idea to me... How about calling the page
>
>         Cookbook.CodeIngredients

That's a good name for it.

> This is one very popular ingredient IMHO:
>
>         $pagename = ???()
>         $group = PageVar('$Group', $pagename);
>
> Note that I don't remember it exactly, but I think you know which one I
> mean ;-)

  ## Get the name of this group (like {Group}) and page (like {$Name})
  $pagename = ResolvePageName($pagename);
  $group = PageVar($pagename, '$Group');
  $name = PageVar($pagename, '$Name');

That one will probably be commonly used, but it's not a commonly-used
routine that could be added to the core.  I added it to the FAQ page
for now.

Hagan




More information about the pmwiki-users mailing list