[Pmwiki-users] Styling simple table rules

Ciaran ciaranj
Thu Dec 9 01:03:24 CST 2004

After our quick conversation in irc t'other afternoon/morning I
implemented a simple row counter in the simple table markup.  Used in
conjunction with || class="someclass" this gives great flexibility in
the styling of tables. I can now simply setup styles for my users such
|| class="headedTable
|| Item || Size  || Cost ||
|| foo || bar || fish ||
And get a nice table with a grey header...

|| class="tabularList"
|| foo || bar || fish ||
and just get a simple no border, no headings, no nothing, tabular list.

And have these presented in a common style across the Wiki. Whereas
previously in order to colour a heading, we'd have to set the bgcolor
attributes in the advanced tables markup, and people were never quite
matching their styling! *sigh*.

The changes I made were basic/naieve imho, just adding a global
rowCounter that FormatTableRow both used and incremented and modifying
the block table markup to call a function that reset the rowCounter
back to 0/1 before performing the original markup change.

What do you think about putting such a change (although obviously a
much cleverer approach would no doubt be taken as i'm just a 'hacker'
when it comes to PHP <g> into PmWiki2 ? I don't think it is feature
creep as it's a cheap way of ensuring styles on the wiki remain
consistent whilst allowing for flexibility.  The only consideration I
could come up with was to do with alternating row styles. I can see
situations where I might want a header row, and then every other row
after that to alternate in colour.  Does this need to be taken into
account, are there any other common table colouring styles in use ? 
(An alternative approach to the rowcounter approach I took would be to
modify the tablecellattr parameter thats passed into the method, but
as I don't know the specifics of this parameter for my local change I
left it be :) )

Any comments/ideas, does this conflict with philosophy #3.  

P.S I *never* knew about the caption functionality built into simple
tables, this doesn't appear to be documented clearly anywhere.  Its on
the master index, but not in the 'tutorials' for Simple tables.  This
could be quite useful for people :)

Thanks ! - As usual appreciative of all your efforts.
- Ciaran

More information about the pmwiki-users mailing list