Hi Martin,
First there are a couple ways to set the skin already in BoltWire
1) Create your own custom skin setter: myBOLTchooseSkin()
2) More easily you can do simply set $BOLTconfig['skin'] = 'json';
3) By a slight tweak in the code we could make it even easier. If I change
engine.php line 150 from
$BOLTskin = BOLTconfig('skin');
to
if ($BOLTskin == '') $BOLTskin = BOLTconfig('skin');
Then you can set skin in config.php or any plug for that matter by simple
setting $BOLTskin;
Of course you have to write some kind of algorith for the skin selection.
For example lets say you wanted to turn on a mobile skin, you could use
this:
## TURN ON MOBILE SKIN WHERE NEEDED $BOLTmobilePat =
'/(iphone|symbian|android|windows ce|iemobile|blackberry|pre)/i'; $mobile =
preg_match($BOLTmobilePat, $_SERVER['HTTP_USER_AGENT']); if ($mobile > 0)
$BOLTskin = 'mobile';
In your example you would develop a switch around $pageArray[0] or
something.
As for your Json solution--I'd suggest the following hook (new code).
First in library.php (line 505) add this rather than a customized case for
json:
default : if (function_exists('myBOLTfuncOutput')) $value =
myBOLTfuncOutput($value, $args['output']);
Then in your config.php you could add a script like this:
function myBOLTfuncOutput($value, $type) {
if ($type == 'json') return '[ "' . str_replace("\n", '","', $value) . '"
]';
return $value;
}
This gives a person pretty simple and maximum access to function output
options with minimum change to the core.
I've made both the changes suggested above to the core for the next release.
Cheers,
Dan
On Sun, Oct 27, 2013 at 1:21 PM, mz <[email protected]> wrote:
> Since a new release is on its way I like to suggest two modifications I
> made in my installation:
>
> Skins: I would be happy if different skins can simply assigned to page
> names. Right now I put something like "if ($pageArray[0] == 'json')
> $BOLTskin = 'json'; " into my engine file to have a special skin for json
> files. I was not able to write a hook for that. The most easiest way would
> be to put something like pagename.*: skinname into site.config. Maybe
> *.pagename.* and *.pagename too.
>
> Output: I also added "output=json" to BOLTfunc from the library file.
> I did this
>
> case 'json' : $value = '[ "' . str_replace("\n", '","', $value) . '" ]';
> break;
>
> but I suspect there is a better universal solution for that.
> Since some javascript functionalities like autocomplete / typeahead /
> autosuggest are built on json files it would be nice to have this option
> out of the box. I like to run a search on data or info fields and get my
> results in json format to feed my js script.
>
> I use 4.x a lot. I made the experience that I cannot rely on webservices
> which will often dropped when companies go out of business or change their
> business strategy. Even Google dropped a service these days (iGoogle) that
> I used a lot. I rebuild and customize some functionalities for me on 4.x
> since I hope Boltwire is here to stay :-)
>
> Greetings, Martin
>
> --
> 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/groups/opt_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].
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/groups/opt_out.