[pmwiki-users] To all Fox users
carlos.ab at gmail.com
carlos.ab at gmail.com
Sun Mar 16 02:10:02 CDT 2008
Em Sábado 15 Março 2008 17:18, Vince Administration escreveu:
> e a good idea. Then settings would not be
> depending on where the variables are set.
> This is more important for Fox, because there are lots of variables.
> But what I would suggest is that
> you call the array FoxConfig, and not just Fox, and also to populate
> the array with the
> entries from the variables. What I mean is that when fox.php is
> called, it checks which (scalar) variables have been
> set, and fills in the appropriate entries in the array. This way
> present usage will not break.
> Vince
I think it is a good idea and I did the same thing for one recipe I'm doing.
I had another idea with that one and I don't know if this is good or bad to be
used with fox, but I did a simple function called SCDV and other called
SCDVA, based on SDV and SDVA, the C is for conditional and it is something
like this:
function SCDV($cnd,&$var,$val){ # SET CONDITIONAL DEFAULT VALUE
if("($cnd)") if(!isset($var)) $var=$val;
}
function SCDVA($cnd,&$var,$val){ # SET CONDITIONAL DEFAULT VALUE ARRAY
if("($cnd)") foreach($val as $k=>$v) if(!isset($var[$k])) $var[$k]=$v;
}
and I use it like this:
SCDVA(
$EnableSkinOptions & $EnableSkinFont & ($fnt <= 6),
$SkinOptions['fontsize'],
array(
'ini' => "#wiki-main{font-size:",
'end' => "%}"
));
SCDVA(
$EnableSkinOptions & $EnableSkinFont & ($fnt >= '7'),
$SkinOptions['fontsize'],
array(
'ini' => "#body{font-size:",
'end' => "%}"
));
The functions helped me clean my code a bit and I was able to play with
conditionals to set some of the options for a skin.
Just a thought,
Carlos
More information about the pmwiki-users
mailing list