[Pmwiki-users] Extracting groupheader as a separate formatting item

Patrick R. Michaud pmichaud
Mon Nov 1 18:54:09 CST 2004


On Mon, Nov 01, 2004 at 06:38:28PM -0600, James S. Carlson wrote:
> Hi there,
> 
> I'd like to achieve two goals:
> 1. I'd like to not render a sidebar if there isn't one in a group-- in
> other words, in the template for the site, say something like:
> 
> if (Group.SideBar) {
> <div id="sidebar"><!--wiki:$Group.SideBar-->
> }

There's not a "simple" way to do this one.  A somewhat complex
method is:

a.  In the template, put <!--PageLeftFmt--> and <!--/PageLeftFmt-->
    around the sidebar component you want to disable:

      <!--PageLeftFmt-->
        <div id='sidebar'><!--wiki:$Group.SideBar--></div>
      <!--/PageLeftFmt-->

b.  At the end of your config.php, use

      include_once('scripts/stdlayout.php');
      if (!PageExists(FmtPageName('$Group.SideBar',$pagename)))
        $PageLeftFmt = '';
      
> 2. I'd like to make GroupHeader a separate item in my templates, rather
> than having it just spat out by <!--PageText-->
> This would allow something like:
> <div id="groupheader"><!--wiki:$Group.GroupHeader--></div>
> and special formatting.

Does it have to be called 'GroupHeader'?  You can always just leave the
GroupHeader page alone (i.e., empty) and pick some other page name to use
as your separate "group header" item (e.g., 'DivHeader' below).

   <div id='groupheader'><!--wiki:$Group.DivHeader--></div>

If you really want to disable the GroupHeader page, just do 
$GroupHeaderFmt=''; in your config.php.

Pm



More information about the pmwiki-users mailing list