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
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.
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
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
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
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