[pmwiki-users] Nifty css/php trick, but is it safe?
carlos.ab at gmail.com
carlos.ab at gmail.com
Fri Nov 30 12:15:19 CST 2007
Em Sexta 30 Novembro 2007 13:43, Tegan Dowling escreveu:
> Ancilary questions:
> Can anyone offer any improvements, or suggest whether this would or
> would not make a good cookbook recipe? If I put it in, what should I
> call it? Should I treat the .htaccess line that enables php in css as
> a separate recipe from the use of re-usable names for colors in the
> skin?
AFAIK it is safe, but you can also do that from within a skin.php file with
less changes to your Pmwiki installation, like this:
<?php if(!defined('PmWiki')) exit();
## colors
$highlight1 = '#ccc';
$highlight2 = 'green';
$bodytxt = '#ff0000';
$headings = '#008400';
global $action, $HTMLStylesFmt;
if($action == highlight){
$HTMLStylesFmt[body] = "body{color:$highlight}";
}else{
$HTMLStylesFmt[body] = "body{color:$highlight}";
}
$HTMLStylesFmt[headers] = "h1, h2, h3, h4, h5, h6 {
color: $headings;
background-color:$highlight1;}";
$HTMLStylesFmt[sidehead] = .sidehead{background-color:$highlight1};
?>
and you can use if/else and $action as a trigger to use different colors, so
body{} can use $highlight1 or $highlight2 depending on the action as shown
above.
All the best.
CarlosAB
More information about the pmwiki-users
mailing list