On Fri, Mar 13, 2009 at 6:18 AM, Hans <[email protected]> wrote:
>
> Since site.config handles enabling of plugins by checking a page name
> mask, so plugins can be enabled just for certain pages, i was
> wondering if this could not be done for skins as well.
>
> The syntax in site.config would be like for example:
>
> skin: butterfly: main*
> skin: business: commerce*
>
> so the name mask gets used as parameter like it is for plugins.
>
> I experimented with the code so this can work. Here is a suggestion:
>
> in engine.php replace ca line 191
> if (file_exists("$skinPath/$BOLTskin/skin.php"))
> include_once("$skinPath/$BOLTskin/skin.php");
> with these lines:
>
> if (!is_array($BOLTconfig['skin'])) $BOLTconfig['skin'] =
> array($BOLTconfig['skin'] => '*');
> foreach($BOLTconfig['skin'] as $skin => $check) {
>        if (BOLTpageCheck($check)) {
>                $BOLTskin = $skin;
>                if (file_exists("$skinPath/$skin/skin.php"))    
> include_once("$skinPath/$skin/skin.php");
>        }
> }
>
> The first line sets a skin:skinname parameter as an array, after that
> the config skin array is checked and the correct skin applied in
> accordance to the filemask check.
>
> Seems to work in my limited tests.

For whatever reason, I think I prefer to do it a little earlier. I
tried this code to replace ~88. Seemed cleaner to me.

if (is_array($BOLTconfig['skin'])) {
        foreach($BOLTconfig['skin'] as $skin => $check) {
                if (BOLTpageCheck($check)) $BOLTskin = $skin;
                }
        }
else $BOLTskin = BOLTconfig('BOLTskin');

However, I note if you have skin: black before skin:triad: test* in
site.config, the code generating the code behaves erratically. If it
comes after it overrides the array (predictable). Not sure whether or
not to worry about it. I'll put in for the next release.

> I would also relax the syntax for config array a little to allow spaces after 
> :
> like
> skin: butterfly: main*
>
> At present  no spaces are permitted before 'butterfly'.
> for this i added \s* to code line 45:
>    preg_match_all('/^(enable([-\w]+)\:?|([-\w]+)\:)\s*(([-\w]+)\:)?(.*?)$/m',
> $config, $m);

Think I prefer to keep it tighter, as the space seems to help set off
the value from the label a bit better. I would almost prefer this
syntax:

skin[black]: test*

What do you think about setting up the pattern this way. Should be
easy enough....

Cheers,
Dan

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"BoltWire" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/boltwire?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to