[Pmwiki-users] update on $MaxIncludes

Patrick R. Michaud pmichaud
Tue May 4 22:58:27 CDT 2004


On Tue, May 04, 2004 at 09:04:46PM +0100, J. Meijer wrote:
> 
> Description
> Instead of counting (page-)includes, an array $IncludedFiles is maintained.
> Includes are only processed when the file has not yet been included, i.e.
> the pagename is not yet in the $IncludedFiles array. 

Good idea, but veto.  Simply keeping track of pagenames means that
two separate sections of an included page cannot be used (via the
new extended [[include:Page#a#b]] syntax), and overall it violates
the principle of least surprise because authors/admins will be confused 
when a page isn't included more than once even though it's specified
more than once.

> this system has a side-effect that is especially useful when composing menus
> in the side-bar using the <!--wiki:$Group.Menu--> syntax in the .tmpl file:
> a menu can be listed twice or more, but will be included only once.
> F.e. this is a section from .tmpl that includes both a global (main) and a
> group-menu:
>   <!--wiki:$Group.Menu-->
>   <!--wiki:Main.Menu-->
> But when the group is Main the page looks ugly using the $MaxIncludes
> version.

Agreed that there ought to be some way to resolve this.  One easy
approach is to change the names slightly, as in either

   <!--wiki:$Group.GroupMenu-->
   <!--wiki:Main.Menu-->

or

   <!--wiki:$Group.Menu-->
   <!--wiki:Main.GlobalMenu-->

This entirely resolves the problem of Main.Menu being included twice,
while making it clear when the menus appear (in the first example, GroupMenu
is a per-group menu; in the second, GlobalMenu is a "global" menu).

Thanks for the excellent suggestion!

Pm



More information about the pmwiki-users mailing list