Re: [SMW-devel] Newbie question: how to use a config variable in javascript

2015-07-02 Thread Frank Baxmann
now you should be able to get the variables in JS with mw.config.get... On 02.07.2015 15:25, Krabina Bernhard wrote: repacing the line breaks somehting else. So I added both $GLOBALS['wgHooks']['MakeGlobalVariablesScript'][] = 'MapsHooks::onMakeGlobalVariablesScript'; $GLOBALS['wgHooks

Re: [SMW-devel] Newbie question: how to use a config variable in javascript

2015-07-02 Thread Krabina Bernhard
repacing the line breaks somehting else. So I added both $GLOBALS['wgHooks']['MakeGlobalVariablesScript'][] = 'MapsHooks::onMakeGlobalVariablesScript'; $GLOBALS['wgHooks']['ResourceLoaderGetConfigVars'][] = 'MapsHooks::onResourceLoaderGetConfigVars'; which doesn't seem to break anything.

Re: [SMW-devel] Newbie question: how to use a config variable in javascript

2015-07-02 Thread James Montalvo
I believe what you want is for this line: https://github.com/krabina/Maps/blob/master/Maps.php#L85 to instead say: $GLOBALS['wgHooks']['ResourceLoaderGetConfigVars'][] = 'MapsHooks::onMakeGlobalVariablesScript'; On Thu, Jul 2, 2015 at 7:33 AM, Krabina Bernhard wrote: > Sorry, but I can't sor

Re: [SMW-devel] Newbie question: how to use a config variable in javascript

2015-07-02 Thread Krabina Bernhard
Sorry, but I can't sort this out. What I want to achieve can be seen here: https://github.com/krabina/Maps/blob/master/includes/services/Leaflet/jquery.leaflet.js#L133-136 I want to be able to configure whicht service should be called. In https://github.com/krabina/Maps/blob/master/Maps_Sett

Re: [SMW-devel] Newbie question: how to use a config variable in javascript

2015-07-02 Thread James Montalvo
You need to tell MW to expose the PHP variables in JS, which you do by adding a ResourceLoaderGetConfigVars hook. https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderGetConfigVars On Jul 2, 2015 6:21 AM, "Frank Baxmann" wrote: > Hi Bernhard, > > JavaScript (on browser) can not access php v

Re: [SMW-devel] Newbie question: how to use a config variable in javascript

2015-07-02 Thread Frank Baxmann
Hi Bernhard, JavaScript (on browser) can not access php variables (on server). You have to make them available to JS by sending them to the browser. I use additional JS for this, but there is somewhere in MW a class for adding variables with MW. And these you can then catch in JS with mw.config.ge