I used similar approach in an extension file, you just put the tag <sp1>
some text whatever </sp1> into the site and what comes up ist html-code
untouched by the wiki, there you should be able to put your javascript code
<?php
# Example WikiMedia extension
# with WikiMedia's extension mechanism it is possible to define
# new tags of the form
# <TAGNAME> some text </TAGNAME>
# the function registered by the extension gets the text between the
# tags as input and can transform it into arbitrary HTML code.
# Note: The output is not interpreted as WikiText but directly
# included in the HTML output. So Wiki markup is not supported.
# To activate the extension, include it from your LocalSettings.php
# with: include("extensions/ExampleExt.php");
$wgExtensionFunctions[] = "wfH1Ext";
function wfH1Ext() {
global $wgParser;
// register the extension with the WikiText parser
// the first parameter is the name of the new tag. In this case it
defines the tag <example> ... </example>
// the second parameter is the callback function for processing the text
between the tags
$wgParser->setHook( "SP1", "SP1Formatter" );
}
// The callback function for converting the input text to HTML output
function SP1Formatter( $input )
{global $wgParser;
$output = "<form
action='https://www.paypal.com/cgi-bin/webscr'
method='post'><input type='hidden' name='cmd'
value='_xclick'>......
name='submit' alt='Zahlen Sie mit PayPal - schnell, kostenlos und
sicher!'></form>";
return $output;
}
?>
-----Ursprüngliche Nachricht-----
Von: mediawiki-l-bounces(a)Wikimedia.org
[mailto:mediawiki-l-bounces@Wikimedia.org]Im Auftrag von Alistair
Johnson
Gesendet: Sonntag, 19. Dezember 2004 20:15
An: 'MediaWiki announcements and site admin list'
Betreff: RE: [Mediawiki-l] Java Script
Giovanni,
I had a similar problem a couple of weeks ago & Jamie was kind enough to
provide the following advice:
-----Original Message-----
From: Jamie Bliss [mailto:astronouth7303@gmail.com]
Sent: Wednesday, 8 December 2004 8:54 a.m.
To: MediaWiki announcements and site admin list
Subject: Re: [Mediawiki-l] custom extension including <script> tags
Try placing the code in a seperate file and referencing it in a single
line. This works for me:
function renderRandomQuote( $input )
{
$output = '<script type="text/javascript"
src="http://www.chiefdelphi.com/forums/xml/spotlight_js.php">&…
<a
href="http://www.chiefdelphi.com/"
title="http://www.chiefdelphi.com/"><img
src="http://furc.zapto.org/wiki/stylesheets/monobook/external.png"
</a><span
class="urlexpansion">
(<i>http://www.chiefdelphi.com/</i>)</span>';
return $output;
}
(This is actually in use on "http://furc.zapto.org/wiki/", using the
tag <randomquote>) I think the code that handles the output doesn't
preserve things within <script> tags, but it will preserve attributes.
So the way to work around this problem is to keep the javascript in an
external file & call it via an extension. Note that the call
*must* be on a
single line to make this work.
al.
-----Original Message-----
From: Giovanni [mailto:gputignano@tiscali.it]
Sent: Monday, 20 December 2004 12:23 a.m.
To: Jamie Bliss; MediaWiki announcements and site admin list
Subject: Re: [Mediawiki-l] Java Script
I want to use JavaScript in a wiki that I use to create eBay insertion so
I'm the only that use that wiki.
I would like to know how to unblock <script> tag for the purpose I said
above.
Thanks,
Giovanni
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l(a)Wikimedia.org
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l(a)Wikimedia.org
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l