I like you rproposition and I really love your idea of a theme command,
instead of tweaking the config file, so please go ahead :-)
On Boltwire website, my id is Maelite.
Cheers,
Tiffany
Le lundi 27 octobre 2014 11:49:16 UTC+1, Dan a écrit :
>
> Thinking a bit more... Particularly about the idea of being able to
> change multiple settings in skins--what if we made this change to
> engine.php around line 165
>
> BOLTstopWatch('Skin creation begun');
> $out = preg_replace('/\=\=(.*?)\=\=/e', 'BOLTdomarkup("$1", $pageLink,
> "SKIN")', $out); // Put markup in skin directly--like ==[(function)]==
> preg_match_all('/\[\[([-_a-z0-9]+)\]\]/i', $out, $matches); // identify
> zones
> $BOLTvar['zones'] = strtolower(implode(',', $matches[1]));
> foreach($matches[1] as $zone) $BOLTvar["zone_$zone"] = BOLTgetlink($zone);
> foreach($matches[1] as $zone) {
> BOLTstopWatch("Zone $zone begun");
> $out = str_replace("[[$zone]]", BOLTgetzones($zone), $out); // Do each
> zone
> BOLTstopWatch("Zone $zone complete");
> }
> // MOVED NEXT LINE FROM ABOVE TO HERE
> $out = preg_replace('/\<\<([-_a-z0-9\.]+)\>\>/ie', "BOLTloadskin('$1')",
> $out); // Code zone--like <<css>>
> $out = preg_replace('/\{([-_a-z0-9:]+)\}/ie', "BOLTskinSettings('$1')",
> $out); // Inserts {vars} from code.settings page
> BOLTstopWatch('Skin creation complete');
> $out = BOLTescape($out, false); // Undo escaped content
>
> My thinking is, you could easily create a function to dynamically change
> themes by putting them in a zone. So putting [(theme blue)] on a page or
> header for example could call this function:
>
> function BOLTFtheme($args) {
> global $BOLTcssPrefix;
> $BOLTcssPrefix = $args[1];
> }
>
> This way, when when the css is loaded, the css prefix (theme) is set and
> the right colors get selected. If you want to give users access to control
> their own preferences in some way, you could easily do [(theme {~theme})]
> and set the "theme" data var on a users page to blue or whatever.
>
> I don't see any significant problems with switching the order of the page
> construction, and some big plusses. What do you think?
>
> Cheers,
> Dan
>
> PS. What's your user id at BoltWire? I'll authorize you to edit your
> plugin page so you can update as needed...
>
>
>
>
>
> On Mon, Oct 27, 2014 at 5:35 AM, The Editor <[email protected] <javascript:>>
> wrote:
>
>> Hi Tiffany,
>>
>> This is a great idea. I've been toying with doing something like this to
>> make it possible to give skins color themes, and be able to change multiple
>> settings all at once. As usual your solution is simple and elegant.
>>
>> I will change the core code to put a hook in the BOLTskinSettings
>> function so you don't have bother creating a custom myBOLTmakePage
>> function. And I think I would like to include some of your idea into the
>> core as well.
>>
>> Here's what I'm looking at for the next release:
>>
>> function BOLTskinSettings($var, $skin=true) {
>> ## RETRIEVES DATA FROM CODE.SETTINGS PAGE TO FILL {VARS} MARKUPS IN YOUR
>> SKIN, OR REGULAR PAGES.
>> if (function_exists('myBOLTskinSettings')) return
>> myBOLTskinSettings($var, $skin);
>> global $BOLTzone, $BOLTcssPrefix;
>> $zone = BOLTinit('SKIN', $BOLTzone);
>> $out = BOLTvars("code.settings::{$BOLTcssPrefix}_$var", false);
>> if ($out == '') $out = BOLTvars("code.settings::$var", false);
>> if ($out != '') return BOLTdomarkup($out, '', $zone); // should reflect
>> local zones too?
>> if (inlist($var, 'skin,script,shared,field,files,domain')) return
>> BOLTvars($var);
>> }
>>
>> You'll see it creates a $BOLTcssPrefix variable rather than making it a
>> part of BOLTconfig. Not sure the pro's or cons either way--just seemed
>> simpler to me. And second I did not include the feature of allowing members
>> to override settings by simple info vars--as it seemed a bit risky by
>> default. I would also suggest using data vars rather than info vars (or
>> perhaps info vars in a data var). This way you don't have to display a
>> member's preferences on their page--and it may be easier to present their
>> preference selection in a nice form. If you did this and include my var
>> instead of using BOLTconfig, the plugin might look like this:
>>
>> (Warning: Haven't tested this...)
>>
>> function myBOLTskinSettings($var, $skin=true) {
>> ## RETRIEVES DATA FROM CODE.SETTINGS PAGE TO FILL {VARS} MARKUPS IN YOUR
>> SKIN, OR REGULAR PAGES.
>> global $BOLTzone, $BOLTcssPrefix;
>> $zone = BOLTinit('SKIN', $BOLTzone);
>> if (inlist($var, 'skin,script,shared,field,files,domain')) return
>> BOLTvars($var);
>> if (set($BOLTcssPrefix)) {
>> $out = BOLTvars("member.$BOLTid:{$BOLTcssPrefix}_$var", false); //
>> DATA VAR HERE
>> if ($out == '') $out = BOLTvars("code.settings::{$BOLTcssPrefix}_$var",
>> false);
>> }
>> if ($out == "default" || $out == '') $out = BOLTvars("member.$BOLTid:$var",
>> false); // ARE YOU SURE YOU WANT TO ALLOW THIS?
>> if ($out == '') $out = BOLTvars("code.settings::$var", false);
>> if ($out != '') return BOLTdomarkup($out, '', $zone); // should reflect
>> local zones too?
>> return $out;
>> }
>>
>> Of course, since it is a plugin, you could set this up anyway you want.
>> Let me know what you'd prefer and I can upload it to the server...
>>
>> Cheers,
>> Dan
>>
>>
>> On Sun, Oct 26, 2014 at 3:59 AM, Tiffany Grenier <[email protected]
>> <javascript:>> wrote:
>>
>>> Hello again!
>>>
>>> I just wrote a small plugin allowing to change the values of the
>>> skinvars for some members or on somepages only.
>>> I called it cssprefix, because it works by adding a prefix to the
>>> skinvars, and I mainly used it to change the colors of some pages without
>>> even touching the skin file.
>>> I would gladly maintain this plugin, if it is published on the website.
>>>
>>> To use it, choose a prefix name (let's say "test"), and write in
>>> config.settings things like test_sitename: Test website or
>>> test_text_color:violet in order to change the sitename or the text color on
>>> pages with test cssprefix enabled.
>>> Then, to use prefix test only on page plugins and its subpages, edit
>>> your config file and write: if(in_array("plugins",$pageArray))
>>> $BOLTconfig['cssPrefix'] = "test";
>>> Or to use prefix test on page plugins only, edit your config file and
>>> write: if($pageLink == "plugins") $BOLTconfig['cssPrefix'] = "test";
>>> Members can also write on their profile "member" page:
>>> /*test_background_color: #0000ff*/ if they want to change the background
>>> color for pages with test cssprefix enabled. But, with this customization
>>> plugin, members can also write on their profile page: /*background_color:
>>> dimgray*/
>>>
>>> The plugin could probably be edited to disallow personal customization
>>> for members, or limit it to certain skinvars, like colors but not sitename,
>>> and I'll probably add that feature later, but you can also not tell your
>>> members the name of your skinvars, and/or not tell them about this feature;
>>> they won't think of it by themselves ;-)
>>>
>>> The cssprefix.php file contains the following:
>>> <?php if (!defined('BOLTWIRE')) exit();
>>>
>>> function myBOLTmakePage($out) {//the only change is the call to
>>> myBOLTskinSettings instead of BOLTskinSettings; this should be limited to
>>> the page content generation, since we only want the layout to be
>>> customizable
>>> global $pageLink,$BOLTreplaceHTML,$BOLTserverHeaders;
>>> BOLTstopWatch('Skin creation begun');
>>> $out = preg_replace('/\<\<([-_a-z0-9\.]+)\>\>/ie',
>>> "BOLTloadskin('$1')", $out); // Code zone--like <<css>>
>>> $out = preg_replace('/\=\=(.*?)\=\=/e', 'BOLTdomarkup("$1",
>>> $pageLink, "SKIN")', $out); // Put markup in skin directly--like
>>> ==[(function)]==
>>> BOLTstopWatch('Skin creation complete');
>>> preg_match_all('/\[\[([-_a-z0-9]+)\]\]/i', $out, $matches); //
>>> identify zones
>>> $BOLTvar['zones'] = strtolower(implode(',', $matches[1]));
>>> foreach($matches[1] as $zone) $BOLTvar["zone_$zone"] =
>>> BOLTgetlink($zone);
>>> foreach($matches[1] as $zone) {
>>> BOLTstopWatch("Zone $zone begun");
>>> $out = str_replace("[[$zone]]", BOLTgetzones($zone), $out); //
>>> Do each zone
>>> BOLTstopWatch("Zone $zone complete");
>>> }
>>> $out = preg_replace('/\{([-_a-z0-9:]+)\}/ie',
>>> "myBOLTskinSettings('$1')", $out); // Inserts {cssprefix-vars} from
>>> code.settings or member page
>>> $out = BOLTescape($out, false); // Undo escaped content
>>> $out = preg_replace('/\[messages( [~,-_a-z0-9]+)?\]/ie',
>>> 'BOLTmessageDisplay("$1")', $out); // Display messages
>>> if (BOLTconfig('robotBlock') != '') { // can turn specific pages
>>> off for robots. Use site*,test.block
>>> if (BOLTpageCheck(BOLTconfig('robotBlock'))) {
>>> $BOLTreplaceHTML['find'][] = '</head>';
>>> $BOLTreplaceHTML['replace'][] = "<meta name='robots'
>>> content='noindex'>\n</head>";
>>> }
>>> }
>>> if (is_array($BOLTreplaceHTML)) $out =
>>> str_replace($BOLTreplaceHTML['find'], $BOLTreplaceHTML['replace'], $out);
>>> // Any custom code replacements
>>> if (is_array($BOLTserverHeaders)) { foreach($BOLTserverHeaders as
>>> $h) header($h); } // Add custom headers
>>> return $out;
>>> }
>>>
>>> function myBOLTskinSettings($var, $skin=true) {
>>> global $BOLTzone,$BOLTconfig,$BOLTid;
>>> $zone = BOLTinit('SKIN', $BOLTzone);
>>> if (inlist($var, 'skin,script,shared,field,files,domain')) return
>>> BOLTvars($var);
>>> if (!empty($BOLTconfig['cssPrefix'])) {
>>> $out =
>>> BOLTvars("member.$BOLTid::".$BOLTconfig['cssPrefix']."_".$var, false);
>>> if ($out == '') $out =
>>> BOLTvars("code.settings::".$BOLTconfig['cssPrefix']."_".$var, false);
>>> }
>>> if ($out == "default" || $out == '') $out =
>>> BOLTvars("member.$BOLTid::$var", false);
>>> if ($out == '') $out = BOLTvars("code.settings::$var", false);
>>> if ($out != '') return BOLTdomarkup($out, '', $zone); // should
>>> reflect local zones too?
>>> return $out;
>>> }
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "BoltWire" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected] <javascript:>.
>>> To post to this group, send email to [email protected]
>>> <javascript:>.
>>> Visit this group at http://groups.google.com/group/boltwire.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>
--
You received this message because you are subscribed to the Google Groups
"BoltWire" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/boltwire.
For more options, visit https://groups.google.com/d/optout.