Summary: Simple table have CSS class added to facilitate customisation
Created: 2006-01-09 15:00
Status: Reopened, does not really exist
Version: 2.1 beta
Description: To facilititate customistion using CSS could the table tag generated for simple tables markup please have a class added to it. eg
This will allow easy customisation fo simple tables without affecting complex tables and other tables generated by PmWiki.
You can already do this. Just put in
I think you can use any attributes.
Here is an example:
And be sure to check out this link! FormattingSimpleTables
thanks, but I don't want all my wiki users to have to know and remember how to do this, I want to do it for them
Not only can an author specify a class for the table, but the wiki administrator can also set default styles for simple tables by changing the setting of $BlockMarkups['table'] in local/config.php:
$BlockMarkups['table'] = '<table width="50%" class="wikisimpletable">';
tried this, but it did not work - in config.php
$BlockMarkups['table'] = '<table class="wikisimpletable">';in page
---- ||test|| ----html generated
<hr /> <div class='vspace'></div><<tr ><td >test</td></tr> a <div class='vspace'></div><hr />
it also appears this change may affect all tables generated, not just those created from simple table markup
Thanks. But it would be simpler, and a straightforward change to make this small change available to all PmWiki administrators. Please please please add the CSS hook for simple tables. --SimonThis cannot easily be done in the Core without possibly breaking existing wikis with simple tables with a
## ||table attributes Markup('^||','>^||||','/^\\|\\|(.*)$/e', "PZZ(\$GLOBALS['BlockMarkups']['table'] = " ."'<table class=\"wikisimpletable\" '.PQA(PSS('$1')).'>') .'<:block,1>'");
If you think this works for you, and as there haven't been any votes from other users for 4+ years, we could maybe close this entry. --Petko January 10, 2010, at 06:22 PM
Thanks. I don't see why this would break any existing wiki. This would simply be a default class added in addition to any a user declares in a class= parameter. This is similar to changes that have been made for buttons in this time frame which have made them much easier to format using local.css.
From PM on mailing list 2010-01-12
The problem is that this isn't actually "simple" nor "straightforward". PmWiki doesn't have an easy way to put a default class "in addition to any a user declares" -- as things currently exist it can either use a hard-coded one, fall back to a default, or accept the class declaration provided by the user. There's not a simple mechanism for combining classes (which, btw, I personally find to be a serious flaw in the design of CSS itself).
So, add "a default class in addition to a user-declared class" would actually require substantial code changes to the simple table markup. It also would remove the ability for users to create a simple table without having the default class in it. So, what you're describing is not at all a trivial change, and does impact existing wikis.
It's entirely possible for a wiki administrator to set a default class explicitly in config.php (the PITS comments incorrectly omit the required  subscript):
$BlockMarkups['table'] = "<table class='wikisimpletable' width='100%'>";
This sets the default class for any simple tables that get generated, although it can be overridden by any user-supplied class. It only affect simple tables -- it doesn't change the class settings for advanced tables or other tables that PmWiki generates.
Having looked at it a bit further, I don't have a big problem with the above $BlockMarkup value being set as the default in stdmarkup.php, as long as we're clear that any user-supplied class= attribute continues to override the default class attribute, and is not in addition to it.
For what it's worth, I struggled for a couple of hours to get this to work, with no luck. Finally I realised I could define a CSS style using '#wikitext table' to do exactly what I wanted. Even better, the table style is limited to the wikitext div, so it doesn't impact on other page elements. Of course, this needs the #wikitext section to be defined in the skin... I'm not sure how standard this is. - MichaelR 12/9/2011