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 serv...@frankbaxmann.de wrote: Hi Bernhard, JavaScript (on browser)

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

2015-07-02 Thread Krabina Bernhard
Hi, I'm hacking my way around these days and I have a newbie question: If a variable is set in an extension (e.g. $GLOBALS['$egMapsTest'] = 'http://{s}.tile.osm.org/{z}/{x}/{y}.png'; How can I access this variable in a JavaScript? The only hint I found so far is var Test2 =

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

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 krab...@kdz.or.at wrote: