[Pmwiki-users] Re: Re: Directive for disabling the side-bar

Patrick R. Michaud pmichaud
Wed Feb 11 10:55:47 CST 2004


On Tue, Feb 10, 2004 at 11:59:22PM +0100, Christian Ridderstr?m wrote:
> On Tue, 10 Feb 2004, Patrick R. Michaud wrote:
> > AFAICT, there's not an easy way in CSS to have columns that change 
> > width/position depending on the display of other columns *and* that 
> > works in the popular browsers (notably IE).  This is one area where
> > working with tables is definitely easier than CSS.
> 
> I.e., if we wanted a [[nosidebar]], that'd mean the directive 
> would have to cause a different CSS to be used. Shouldn't be impossible, 
> but hardly a priority.

Yes, exactly.  And CSS layouts finally frustrated me so much that 
I've added an option to choose a table-layout for the middle of the page,
with divs for everything else.  It's fairly well optimized--only one
table in the layout and no empty cells are generated.

Then I started to write a description (below) about how things work in
the new layout, and discovered that [[noheader]] and [[nofooter]] were
going to be broken anyway, so I redid the whole layout yet again and 
there's now going to be a [[nosidebar]] directive.  :-)

So, here goes...

[[append:PmWiki.StdLayoutConfig]]      <--I wish this worked already!  :-)

Here's what I finally ended up with for the standard layout.
Basically, a page is organized into a sequence of blocks for each
component of the page.  Also, because I was having so much trouble
making effective column layouts using just <div>s and CSS, there's an 
option ($EnableStdLayoutTable) that renders the middle section of
the page as a table.  I know tables-for-layout are often frowned upon,
but it's just one table, it works across browsers, and the admin can
easily change to divs.

w/$EnableStdLayoutTable==0          $EnableStdLayoutTable==1
    body                                body
      div#wikilogo                        div#wikilogo
      div#wikihead                        div#wikihead
      div#wikileft                        table#wikimid
      div#wikibody                          td#wikileft
        div#wikititle                       td#wikibody
        div#wikicmds                          div#wikititle
        div#wikitext                          div#wikicmds
          page contents                       div#wikitext
      div#wikiright                             page contents
      div#wikifooter                        td#wikiright
                                        div#wikifooter

Each of the items above is stored in the $PageLayoutFmt array,
thus $PageLayoutFmt['wikilogo'] is the logo output, 
$PageLayoutFmt['wikileft'] controls what appears in the left sidebar,
etc.  The layout code is quite efficient in that it doesn't generate 
any empty div or table blocks in the output--it only generates the
blocks that actually have content.  So, to disable the sidebar, one
just does $PageLayoutFmt['wikileft']=''; .

The old 0.5-layout $PageHeaderFmt, $PageFooterFmt, and $PageTitleFmt 
variables continue to exist and work as before.  By default
$PageHeaderFmt contains wikilogo and wikihead, $PageFooterFmt 
contains wikifoot, and $PageTitleFmt contains wikititle and wikicmds.
[[noheader]], [[nofooter]], and [[notitle]] continue to set these
variables to an empty string, as before.  In addition, I will likely 
be adding [[nosidebar]] to provide similar control for wikileft and 
wikiright (can already be done as a local customization).

Stdlayout.php also adds a $PageStyle variable, which controls the
stylesheet selection.  CSS style sheets are loaded in the following
sequence, if they exist:  stdlayout.css, $PageStyle.css, local.css, 
$Group.css, and $Group.$Title_.css.  Of course, this can be customized
as well.  By default $PageStyle will be set to 'pmwiki', the standard
distribution layout (whatever it ends up being).

All of this makes it really easy to develop new layouts (skins) and
to switch between them.  There's already a cookbook section started
that demonstrates different layouts and provides the source code and
description of the layout--see http://www.pmichaud.com/wiki/Cookbook/Skins.  
Note that visiting these pages changes your default skin used for other 
pages on pmichaud.com (until you close your browser).  :-)

[[append:]]

For a short while I'll be glad to develop CSS and skin files for others
that duplicate existing layouts, provided you let me post the files
as examples in the Cookbook.  Or feel free to upload your own skins
files to the Cookbook (I'll have to enable the skin-changing locally,
however).

Pm



More information about the pmwiki-users mailing list