Startpage >> PmWiki >> CustomWikiStyles

Custom Wiki Styles

PmWiki.CustomWikiStyles History

Hide minor edits - Show changes to output

August 31, 2011, at 11:59 AM by Blahma -
Changed lines 1-80 from:
Life is short, and this article saved vaulbale time on this Earth.
to:
(:Summary: Predefined PmWiki styles & adding custom wiki styles:)
(:Audience: administrators (intermediate) :)
This page describes the predefined [[Wiki Styles]] and how a [[Wiki Administrator]] can define additional [[Wiki Styles]] as a local customization for all pages (in local/config.php) or specific groups (in local/$Group.php).

All predefined [[Wiki Styles]] are setup in the global array $WikiStyle.
To define your own [[Wiki Styles]], add the setting of the correspondent `WikiStyle within the array.

[[#predef]]
!! Predefined Wiki Styles

The following array-values are set by [@scripts/wikistyles.php@] using the [[Cookbook:Functions#SDV |SDV()-function]] (so you can overwrite them by setting them prior in config.php or farmconfig.php):

||width=70% border=1 cellpadding=3 cellspacing=0
||'''markup:''' ||'''definition:''' ||
||[[<<]]'''text colors:''' [[<<]] (equiv. to [@%define=xxxx color=xxxx%@] ||||
|| [@%black%@] ||[@$WikiStyle['black']['color'] = 'black';@] ||
|| [@%white%@] ||[@$WikiStyle['white']['color'] = 'white';@] ||
|| [@%red%@] ||[@$WikiStyle['red']['color'] = 'red';@] ||
|| [@%yellow%@] ||[@$WikiStyle['yellow']['color'] = 'yellow';@] ||
|| [@%blue%@] ||[@$WikiStyle['blue']['color'] = 'blue';@] ||
|| [@%gray%@] ||[@$WikiStyle['gray']['color'] = 'gray';@] ||
|| [@%silver%@] ||[@$WikiStyle['silver']['color'] = 'silver';@] ||
|| [@%maroon%@] ||[@$WikiStyle['maroon']['color'] = 'maroon';@] ||
|| [@%green%@] ||[@$WikiStyle['green']['color'] = 'green';@] ||
|| [@%navy%@] ||[@$WikiStyle['navy']['color'] = 'navy';@] ||
|| [@%purple%@] ||[@$WikiStyle['purple']['color'] = 'purple';@] ||
||[[<<]]'''list-styles:''' ||||
|| [@%decimal%@] ||[@$WikiStyle['decimal']['apply'] = 'list';@][[<<]][@$WikiStyle['decimal']['list-style'] = 'decimal';@] ||
|| [@%roman%@] ||[@$WikiStyle['roman']['apply'] = 'list';@][[<<]][@$WikiStyle['roman']['list-style'] = 'lower-roman';@] ||
|| [@%ROMAN%@] ||[@$WikiStyle['ROMAN']['apply'] = 'list';@][[<<]][@$WikiStyle['ROMAN']['list-style'] = 'upper-roman';@] ||
|| [@%alpha%@] ||[@$WikiStyle['alpha']['apply'] = 'list';@][[<<]][@$WikiStyle['alpha']['list-style'] = 'lower-alpha';@] ||
|| [@%ALPHA%@] ||[@$WikiStyle['ALPHA']['apply'] = 'list';@][[<<]][@$WikiStyle['ALPHA']['list-style'] = 'upper-alpha';@] ||
||[[<<]]'''special:''' ||||
||open links in a new browser-window: ||||
|| [@%newwin%@] ||[@$WikiStyle['newwin']['target'] = '_blank';@] ||
||Turns markup into a comment via display:none CSS ||||
|| [@%comment%@] ||[@$WikiStyle['comment']['display'] = 'none';@] ||

!!Author-Defined Wiki Styles

# The first index of the array defines the style name (e.g. mynewstyle, projectentry etc)
# the second index defines the attribute name (e.g. color, background-color, etc.)
# the value set defines the attribute value (e.g. red, bold, #00ffcc, etc.)

'''Sample:''' If you want to define a (site-wide) style the same as the page style
->[@%define=projectentry color:red%@]
use
->[@$WikiStyle['projectentry']['color'] = 'red';@]


The [@$WikiStyle['projectentry']['apply']@] variable may be defined if the wikistyle concerns a particular tag. It may be @@'item' (for li|dt), 'list' (for ul|ol|dl), 'div', 'pre', 'img', 'p'@@ or the combining @@'block' (for p|div|ul|ol|dl|li|dt|pre|h[1-6])@@. Example:

[@$WikiStyle['top']['apply'] = 'item';@]
[@$WikiStyle['top']['class'] = 'top';@]

then a markup
[@* %top% An important list-item@]
will output
[@<li class="top">An important list-item</li>@]

!! Printer-Friendly Styles

If your custom-styles (in local/config.php) are getting very colorful it might be useful to disable them in print-view. This can be done easily by putting them into a condition.

[@if($action!="print") {
// your custom-styles
}@]

!!Notes

!!!To be done:

!!Questions:
'''I tried this but background didn't work, thou border and float worked?''' /Vincent 2008-04-08
[@
$WikiStyle['vMenu']['background']='#ffffcc' ;
$WikiStyle['vMenu']['float']='left' ;
$WikiStyle['vMenu']['border']='1px dotted red' ;
@]
->Try using [@$WikiStyle['vMenu']['background-color']='#ffffcc';@] -- unlike @@background@@, @@background-color@@ is defined in the $WikiStyleCSS array, which is checked for valid properties.
July 19, 2011, at 08:27 PM by Ellyanna - kiFjzreRBpzCObXpNiU
Changed line 1 from:
Thanks for sharing. Always good to find a real exerpt.
to:
Life is short, and this article saved vaulbale time on this Earth.
July 19, 2011, at 07:05 PM by Jodecy - -5
Changed line 1 from:
Thanks for wrtiing such an easy-to-understand article on this topic.
to:
Thanks for sharing. Always good to find a real exerpt.
July 19, 2011, at 06:11 PM by Tori - dtTEWaMhAFuc
Changed line 1 from:
That’s more than senilsbe! That’s a great post!
to:
Thanks for wrtiing such an easy-to-understand article on this topic.
July 19, 2011, at 04:19 PM by Johannah - yfqxRJvFxeoVOaKrk
Changed line 1 from:
I ralely appreciate free, succinct, reliable data like this.
to:
That’s more than senilsbe! That’s a great post!
July 18, 2011, at 09:18 PM by Ally - SmWroyPVtZiRf
Changed line 1 from:
You’re on top of the game. Thanks for shanrig.
to:
I ralely appreciate free, succinct, reliable data like this.
July 18, 2011, at 07:52 PM by Kailyn - -5
Changed line 1 from:
If my problem was a Death Star, this article is a pohotn torpedo.
to:
You’re on top of the game. Thanks for shanrig.
July 18, 2011, at 07:56 AM by Katty - LEJwraUAKCd
Changed line 1 from:
I'll try to put this to good use imemdatiely.
to:
If my problem was a Death Star, this article is a pohotn torpedo.
July 17, 2011, at 08:17 PM by Agatha - ZMpNVRNNBi
Changed line 1 from:
To think, I was cnoufsed a minute ago.
to:
I'll try to put this to good use imemdatiely.
July 08, 2011, at 11:38 AM by Kairi - XcrMHPqpuWxrZBak
Changed line 1 from:
aacE9h , [url=http://kwqfyklhhfcb.com/]kwqfyklhhfcb[/url], [link=http://pefuxdmosxeo.com/]pefuxdmosxeo[/link], http://xnrrvhddolsi.com/
to:
To think, I was cnoufsed a minute ago.
July 07, 2011, at 02:50 PM by jdjiwtmdkm - bpfQcXkdpebkxMBjYgv
Changed line 1 from:
XNKE9a <a href="http://mujfpegeqazg.com/">mujfpegeqazg</a>
to:
aacE9h , [url=http://kwqfyklhhfcb.com/]kwqfyklhhfcb[/url], [link=http://pefuxdmosxeo.com/]pefuxdmosxeo[/link], http://xnrrvhddolsi.com/
July 07, 2011, at 09:19 AM by gkquwzow - zKSjYHihygbOtBKwxoe
Changed line 1 from:
Thanks for the inshigt. It brings light into the dark!
to:
XNKE9a <a href="http://mujfpegeqazg.com/">mujfpegeqazg</a>
July 06, 2011, at 04:01 PM by Leatrix - -5
Changed lines 1-80 from:
(:Summary: Predefined PmWiki styles & adding custom wiki styles:)
(:Audience: administrators (intermediate) :)
This page describes the predefined [[Wiki Styles]] and how a [[Wiki Administrator]] can define additional [[Wiki Styles]] as a local customization for all pages (in local/config.php) or specific groups (in local/$Group.php).

All predefined [[Wiki Styles]] are setup in the global array $WikiStyle.
To define your own [[Wiki Styles]], add the setting of the correspondent `WikiStyle within the array.

[[#predef]]
!! Predefined Wiki Styles

The following array-values are set by [@scripts/wikistyles.php@] using the [[Cookbook:Functions#SDV |SDV()-function]] (so you can overwrite them by setting them prior in config.php or farmconfig.php):

||width=70% border=1 cellpadding=3 cellspacing=0
||'''markup:''' ||'''definition:''' ||
||[[<<]]'''text colors:''' [[<<]] (equiv. to [@%define=xxxx color=xxxx%@] ||||
|| [@%black%@] ||[@$WikiStyle['black']['color'] = 'black';@] ||
|| [@%white%@] ||[@$WikiStyle['white']['color'] = 'white';@] ||
|| [@%red%@] ||[@$WikiStyle['red']['color'] = 'red';@] ||
|| [@%yellow%@] ||[@$WikiStyle['yellow']['color'] = 'yellow';@] ||
|| [@%blue%@] ||[@$WikiStyle['blue']['color'] = 'blue';@] ||
|| [@%gray%@] ||[@$WikiStyle['gray']['color'] = 'gray';@] ||
|| [@%silver%@] ||[@$WikiStyle['silver']['color'] = 'silver';@] ||
|| [@%maroon%@] ||[@$WikiStyle['maroon']['color'] = 'maroon';@] ||
|| [@%green%@] ||[@$WikiStyle['green']['color'] = 'green';@] ||
|| [@%navy%@] ||[@$WikiStyle['navy']['color'] = 'navy';@] ||
|| [@%purple%@] ||[@$WikiStyle['purple']['color'] = 'purple';@] ||
||[[<<]]'''list-styles:''' ||||
|| [@%decimal%@] ||[@$WikiStyle['decimal']['apply'] = 'list';@][[<<]][@$WikiStyle['decimal']['list-style'] = 'decimal';@] ||
|| [@%roman%@] ||[@$WikiStyle['roman']['apply'] = 'list';@][[<<]][@$WikiStyle['roman']['list-style'] = 'lower-roman';@] ||
|| [@%ROMAN%@] ||[@$WikiStyle['ROMAN']['apply'] = 'list';@][[<<]][@$WikiStyle['ROMAN']['list-style'] = 'upper-roman';@] ||
|| [@%alpha%@] ||[@$WikiStyle['alpha']['apply'] = 'list';@][[<<]][@$WikiStyle['alpha']['list-style'] = 'lower-alpha';@] ||
|| [@%ALPHA%@] ||[@$WikiStyle['ALPHA']['apply'] = 'list';@][[<<]][@$WikiStyle['ALPHA']['list-style'] = 'upper-alpha';@] ||
||[[<<]]'''special:''' ||||
||open links in a new browser-window: ||||
|| [@%newwin%@] ||[@$WikiStyle['newwin']['target'] = '_blank';@] ||
||Turns markup into a comment via display:none CSS ||||
|| [@%comment%@] ||[@$WikiStyle['comment']['display'] = 'none';@] ||

!!Author-Defined Wiki Styles

# The first index of the array defines the style name (e.g. mynewstyle, projectentry etc)
# the second index defines the attribute name (e.g. color, background-color, etc.)
# the value set defines the attribute value (e.g. red, bold, #00ffcc, etc.)

'''Sample:''' If you want to define a (site-wide) style the same as the page style
->[@%define=projectentry color:red%@]
use
->[@$WikiStyle['projectentry']['color'] = 'red';@]


The [@$WikiStyle['projectentry']['apply']@] variable may be defined if the wikistyle concerns a particular tag. It may be @@'item' (for li|dt), 'list' (for ul|ol|dl), 'div', 'pre', 'img', 'p'@@ or the combining @@'block' (for p|div|ul|ol|dl|li|dt|pre|h[1-6])@@. Example:

[@$WikiStyle['top']['apply'] = 'item';@]
[@$WikiStyle['top']['class'] = 'top';@]

then a markup
[@* %top% An important list-item@]
will output
[@<li class="top">An important list-item</li>@]

!! Printer-Friendly Styles

If your custom-styles (in local/config.php) are getting very colorful it might be useful to disable them in print-view. This can be done easily by putting them into a condition.

[@if($action!="print") {
// your custom-styles
}@]

!!Notes

!!!To be done:

!!Questions:
'''I tried this but background didn't work, thou border and float worked?''' /Vincent 2008-04-08
[@
$WikiStyle['vMenu']['background']='#ffffcc' ;
$WikiStyle['vMenu']['float']='left' ;
$WikiStyle['vMenu']['border']='1px dotted red' ;
@]
->Try using [@$WikiStyle['vMenu']['background-color']='#ffffcc';@] -- unlike @@background@@, @@background-color@@ is defined in the $WikiStyleCSS array, which is checked for valid properties.
to:
Thanks for the inshigt. It brings light into the dark!
Lasta ŝanĝo August 31, 2011, at 11:59 AM