[pmwiki-users] Conditionals in Templates

Petko Yotov 5ko at 5ko.fr
Fri Sep 24 07:28:38 CDT 2010


On Friday 24 September 2010 13:11:08 Scott wrote:
>   On 9/24/2010 2:28 AM, Petko Yotov wrote:
> > On Friday 24 September 2010 03:16:07 Scott wrote:
> >>    I am trying to use a conditional statement in my template:
> >>                   (:if ! group Main:)
> >> 
> >> <!--wiki:Main.SideBar Main.SideBar-->
> >> <hr>
> >> 
> >>                   (:ifend:)
> >> 
> >> <!--wiki:$Group.SideBar Main.SideBar-->
> >> 
> >> Unfortunately, this just outputs the conditional.  I also tried the php
> >> variant and a few other things.
> >> 
> >> What is the correct way to accomplish this?
> > 
> > Hello. If you want to always display the Main.SideBar page, just use
> > 
> >    <!--wiki:Main.SideBar-->
> > 
> > Otherwise, it is simpler to place the conditionals inside the pages, and
> > not in the templates.
> 
> I think it would be simpler from a maintenance stand point to have it in
> the template.  I basically want the Main side bar followed by the group
> side bar.   But on the main page, it would be redundant to have the main
> twice.

You can have wiki markup in the templates like this:
  <!--markup:Whatever--> 

However it would all be one in line and more difficult to edit/update.

If you can live with some wiki markup inside a wiki page, you can use just
  <!--wiki:Main.SideBar--> 

in the template, and at the bottom of the page [[Main.SideBar]], you can have 
your conditional wrapped around (:include {*$Group}.SideBar:).

Petko



More information about the pmwiki-users mailing list