using variables set in localsettings in javascript

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

using variables set in localsettings in javascript

Krabina Bernhard
Dear all,

as I unfortunately cannot call myself a PHP developer, my small commits are more hacks than programming, but I'm trying to improve :-)

I have a basic question, you might laugh about, but I could not find a decent example. Maybe you can help me?

I have figured out how variables are set in localsettings.php and can be reused in PHP code. But if an extension uses JavaScript, how can I make use of a variable that I set in localsettings.php in the JavaScript?

Can anybody point to an example in any SMW extension?

cheers,
Bernhard

------------------------------------------------------------------------------
_______________________________________________
Semediawiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
Reply | Threaded
Open this post in threaded view
|

Re: using variables set in localsettings in javascript

James HK
Hi,

> Can anybody point to an example in any SMW extension?

For a very simple example, please follow:

- `wnbyExternalGeoipService` being specified in [0]
- Is made available to the RL [1]
- Is accessible in JavaScript [2]

[0] https://github.com/SemanticMediaWiki/WhatsNearby/blob/master/WhatsNearby.php#L55

[1] https://github.com/SemanticMediaWiki/WhatsNearby/blob/master/src/HookRegistry.php#L93

[2] https://github.com/SemanticMediaWiki/WhatsNearby/blob/master/res/ext.whats.nearby.js#L83

Cheers

On 4/6/16, Krabina Bernhard <[hidden email]> wrote:

> Dear all,
>
> as I unfortunately cannot call myself a PHP developer, my small commits are
> more hacks than programming, but I'm trying to improve :-)
>
> I have a basic question, you might laugh about, but I could not find a
> decent example. Maybe you can help me?
>
> I have figured out how variables are set in localsettings.php and can be
> reused in PHP code. But if an extension uses JavaScript, how can I make use
> of a variable that I set in localsettings.php in the JavaScript?
>
> Can anybody point to an example in any SMW extension?
>
> cheers,
> Bernhard
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Semediawiki-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
>

------------------------------------------------------------------------------
_______________________________________________
Semediawiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
Reply | Threaded
Open this post in threaded view
|

Re: using variables set in localsettings in javascript

Jeroen De Dauw-2
In reply to this post by Krabina Bernhard
Hey,

Note that this is a MediaWiki question, not really a PHP one. You can be the most brilliant PHP dev out there and still won't know how to do this if you never saw MediaWiki before.

Cheers
Software craftsmanship advocate | Developer at Wikimedia Germany
~=[,,_,,]:3

------------------------------------------------------------------------------

_______________________________________________
Semediawiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel