[Pmwiki-users] Re: Skins - a somewhat radical proposal

John Rankin john.rankin
Sun Nov 14 20:10:56 CST 2004


Almost there I think.

On Monday, 15 November 2004 12:41 PM, Patrick R. Michaud <pmichaud at pobox.com> wrote:

>Also, I hadn't really thought about the case of loading multiple 
>skins on top of each other--(i.e., executing *multiple* skin.php files),
>that seems like it has lots of potential for confusion.  For clarity
>it might be better to just reverse the sense of the array and simply
>load the first skin found.  I'll have to think on this a bit.

In the case of publish.php, it does things for the publish skin plus
sets some variables used for action=browse so that action=publish works.
Being able to install this just by putting a publish/ directory into 
pub/skins/ is a great simplification. But I take your point about
possible confusion.

In other words, if you want to be able to publish, then
pub/skins/publish/publish.php ( or ...skin.php) always has to load.
And is why I'd rather call it publish.php than skin.php.
 
>> >Of course, the question then becomes, what if there's more than one?
>> >For .php files, it could just load all that it finds, but this is
>> >probably a bit dangerous.  Perhaps the better approach is to keep a
>> >restriction that a skin's .php file must be named something like 
>> >"skin.php" or "settings.php" in order to be automatically used.
>> 
>> IMO it should look first for skin.php and then $Skin.php but
>> load only the first it finds. 
>
>Any particular reason for supporting $Skin.php as opposed to just 
>"skin.php"?

It just seems odd and inconsistent that the .tmpl file is $Skin.tmpl
whereas the .php file is skin.php

However, after further thought, I'd reverse the sequence --
look for $Skin.php then skin.php, similarly look for $Skin.tmpl
then skin.tmpl.
>
>>
>I'm not too fond of that skin.tmpl file -- if someone copies a skin
>directory, then copies skin.tmpl to xyzskin.tmpl to make changes, 
>skin.tmpl still gets precedence.

If the sequence were $Skin.tmpl then skin.tmpl then anyfile.tmpl, 
the problem goes away. 

>
>> It would be easier to explain if the rule was the same for
>> .php and .tmpl files, with the addition that a .php file can
>> override the .tmpl rule. For me, skin then $Skin is enough,
>> as the .php can invoke any.tmpl if needed.
>
>Well, that's why I was avoiding the multiple .php file option and staying
>away from $Skin.php.  It's easy to explain that a skin's .php file must 
>be named "skin.php", and a template is the first of
>    - set by skin.php
>    - $Skin.tmpl
>    - any .tmpl file in the skin directory, if there's only one
>    - an error if none of the above are satisfied
>
>This "just works" for all of the skin copying/modification scenarios that
>I can come up with (it even works for "skin.tmpl" even though it's not
>explicitly listed in the rules).
>

The skin.php and $Skin.tmpl is the one bit that I think is confusing.

Supposing pmwiki/ contains pmwiki.tmpl and skin.php; I copy this to
newskin/ and edit both pmwiki.tmpl and skin.php. I save pmwiki.tmpl 
as newskin.tmpl and skin.php as newskin.php. Now why didn't that
work? So I edit skin.php, save a copy as pmwiki.php, make changes 
and save it as skin.php (oops, I just saved it as pmwiki.php by 
mistake; start again). OK perverse example...

FWIW I think I would clearer if it was either

- set by $Skin.php
- $Skin.tmpl
- any .tmpl file if there is one
- an error

or

- set by $Skin.php
- set by skin.php
- $Skin.tmpl
- skin.tmpl
- any .tmpl file if there is one
- an error

But apart from this issue, I like the approach a lot.

-- 
JR
--
John Rankin





More information about the pmwiki-users mailing list