[pmwiki-users] Using variable in skin template
Sandy
sandy at onebit.ca
Sat Oct 24 16:17:13 CDT 2009
DaveG wrote:
>
> Sandy wrote:
>>> Well in order to use the variable from within the template you'd need
>>> use $FmtPV:
>>> $FmtPV['$color1']='"#00cc00"';
>>>
>>> So then you could use it in .tmpl (not in .css files though). Personally
>>> I prefer to use $HTMLStylesFmt.
>>
>> What's up with the two quotation marks? I remember something about " not
>> being the same as ', something about one being literal and the other
>> interpretting the variable names, but google is being dense.
> Because anything assigned to $FmtPV needs to be executable. Refer to
> PmWiki/PageVariables.
>
> ~ ~ Dave
Experiments done for now. Several things work in group.php but not
testskin.php.
I'd like to start with all the skin code in the skin folder so it can
easily be moved between farms. Further customizing can then be done in
either php file, depending on the setup of the new farm.
Result of experiments: Very confused, especially the last result. Must
learn more about skin.php files and experiment more, and re-read the php
tutorials. Trying to learn too many things at once.
Thanks for the help.
Sandy
++++++++++++++++++++
Results of experiments:
-----
$color1 = '#00cc00';
$HTMLStylesFmt['my_skin'] = "h1 {color:$color1;} ";
works in the group.php, but not in testskin.php .
-----
in group.php:
$FmtPV['$color1']='"#00cc00"';
then in .tmpl
<style>
h1 {color:$color1;}
</style>
works.
----
Same thing in testskin.php gives this html:
h1 {color:gold1;}
Suspect $FmtPV['$color1'] is being over-ridden by a recipe. No clue
which one.
----
Try testskin.php again, with different variable name. Resulting .html is:
h1 {color:$Sandy1;}
One has $ and one doesn't. Probably means something to someone who
finished the php tutorials.
--- -
add to each php file:
print_r($HTMLStylesFmt);
Works in group.php. Doesn't work in testskin.php.
----
add line of garbage to testskin.php
yes, the file is being called.
----
in group.php:
$FmtPV['$sandy1']='"#00cc00"';
in testskin.tmpl
<style>
h1 {color:$FmtPV['$sandy1'];}
</style>
Resulting html:
h1 {color:$FmtPV['#00cc00'];}
Rechecked that one with different variable names three times. Offically
confused.
More information about the pmwiki-users
mailing list