Replace div

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

Replace div

Mad4Milk
Hi,

I've a little prob. I wanna replace a single div fom the index by
another one with some js functionality without changing the code.

What would be the best way to implement this?

Regards
Mic


_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Replace div

Rob Church
On 24/10/2007, Michael Heyder <[hidden email]> wrote:
> Hi,
>
> I've a little prob. I wanna replace a single div fom the index by
> another one with some js functionality without changing the code.
>
> What would be the best way to implement this?

A quick bit of Googling would yield the "solution" to this, which is
to either write an extension which injects the desired script into the
output, or just modify the MediaWiki:Common.js page on your wiki.

STFW.


Rob Church

_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Replace div

Mad4Milk
Rob Church schrieb:

> On 24/10/2007, Michael Heyder <[hidden email]> wrote:
>> Hi,
>>
>> I've a little prob. I wanna replace a single div fom the index by
>> another one with some js functionality without changing the code.
>>
>> What would be the best way to implement this?
>
> A quick bit of Googling would yield the "solution" to this, which is
> to either write an extension which injects the desired script into the
> output, or just modify the MediaWiki:Common.js page on your wiki.
>
> STFW.
>
>
> Rob Church

Rob,

the js-script part is not the problem. The greater problem would be to
setup the extension.

mic


_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Replace div

Rob Church
On 24/10/2007, Michael Heyder <[hidden email]> wrote:
> the js-script part is not the problem. The greater problem would be to
> setup the extension.

Your question was how to inject some JavaScript onto wiki pages
without altering the core code, to which I provided two solutions.

If that was not, in fact, the correct question, then ask the correct question.

To use an extension for this, one would write an appropriate hook
callback function which used, e.g. OutputPage::addHeadItem() to inject
the appropriate script or script-sourcing tag (<script
type=...></script>) onto the page.


Rob Church

_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Replace div

Mad4Milk
Rob Church schrieb:

> On 24/10/2007, Michael Heyder <[hidden email]> wrote:
>> the js-script part is not the problem. The greater problem would be to
>> setup the extension.
>
> Your question was how to inject some JavaScript onto wiki pages
> without altering the core code, to which I provided two solutions.
>
> If that was not, in fact, the correct question, then ask the correct question.
>
> To use an extension for this, one would write an appropriate hook
> callback function which used, e.g. OutputPage::addHeadItem() to inject
> the appropriate script or script-sourcing tag (<script
> type=...></script>) onto the page.
>
>
> Rob Church

Similar to this?
<?php
if (!defined('MEDIAWIKI'))
     die();

$wgExtensionCredits['other'][]=array
     (
        //
     );

$wgExtensionFunctions[] = 'wfSetupLiveSearch';

function wfSetupLiveSearch()
{
//doing some stuff
}

or what is meant by hook callback function?

mic


_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Replace div

Rob Church
On 24/10/2007, Michael Heyder <[hidden email]> wrote:
> or what is meant by hook callback function?

"Hook callback function" means "function that is called [back] at a
particular time" - in this case, a function which is "attached" to an
event, which in MediaWiki is done through the "hooks" system.

Read the docs/HOOKS.txt file.


Rob Church

_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://lists.wikimedia.org/mailman/listinfo/mediawiki-l