[pmwiki-users] Nifty css/php trick, but is it safe?

noskule noskule at gmx.net
Fri Nov 30 11:33:28 CST 2007


> Ancilary questions:
> Can anyone offer any improvements, or suggest whether this would or
> would not make a good cookbook recipe?

About the css generating off css. I use this on my wikis, without
touching .htaccess in the following way, explained below.

What I would be intressted in, but don't no how to realize is saving the
color-values in wikipages in a per-group-customizatiuon basis for
example in Group.GroupAttributes or group.CSS-Var or something like. So
an author could easily change the values for example the header bg-color
of the skin for diffrent groups.

If one would do it with pagetextvariables it could even be changed with
a form.

My implementation looks like this:


from skin.tmpl call css.php
skin.tmpl -------------------------------------
....
  <link rel="stylesheet" type="text/css" href="$SkinDirUrl/css.php" />
....


css.php includes css-var.php with the variables and css.css with the css
definitions
css.php ----------------------------------------
<?php
header('Content-type: text/css');

include('css-var.php');
$css = include('css.css');
echo $css;


defining the vars
css-var.php: -----------------------------------
<?php
$basecolor = 'blue';


defining the css
css.css: ---------------------------------------
<?php
return<<<EOF

div.header {
	background:$basecolor;
	}

EOF;
?>



I did a slightly more complex css.php which let me define local
customizations, so if i upgrade the skin the values defined in
css-var.php are still there. Would look like this:


include('netstreams-css-colorsheme.php');
if (is_file('../../../local/netstreams-css-colorsheme.php')) {
include('../../../local/netstreams-css-colorsheme.php');
}


grz nos



More information about the pmwiki-users mailing list