Sorry, typo, I meant to say you'll need to use global $wgOut;
On Wed, Mar 10, 2010 at 12:47 PM, Tisane . <tisane2718(a)gmail.com> wrote:
Hi Tech Geek,
Probably you'll want to start with
http://www.mediawiki.org/wiki/Extensions#Writing_Extensions . There are
several different types of extensions, e.g. special page extensions; hook
extensions; tag extensions; etc. If you're making a special page, for
instance, you can find a simple example called myExtension, utilizing four
files, at
http://www.mediawiki.org/wiki/Manual:Special_pages#Basic_special_page_templ…. There is
a line in the body file you can uncomment/modify to get it to
output something.
Remember that if you're getting it to say "Hello world," you won't be
using
echo("Hello world");, but rather $wgOut->addWikiText("Hello
world"); or
perhaps $wgOut->addHTML("Hello world"); (although be careful about XSS
issues if you use addHTML), and that you'll need to have put globals $wgOut;
earlier in the function to bring it into scope.
You are on the right track in looking at simple extensions already existent
as preparation for writing your own. I used
http://www.mediawiki.org/wiki/Extension:RemoveRedlinks to help me figure
out how to write
http://www.mediawiki.org/wiki/Extension:RPED (which is
still under development but is being tested at
http://rped.org/wiki/index.php?title=RPED:Sandbox ). I think I also looked
at some of the special pages under includes/specials. Don't forget, when
you're looking up stuff on the Mediawiki site, to check out the categories
(e.g.
http://www.mediawiki.org/wiki/Category:Extensions_by_implementation_type )
and their parent and sister categories, which can often help you find the
documentation and extensions that you're looking for.
When I get SVN access, I'll probably add a "hello world" example extension
for easy download by beginners.
Good luck, -Tisane
On Wed, Mar 10, 2010 at 12:08 PM, Tech Geek <techgeek12345(a)gmail.com>wrote;wrote:
Hi all,
I have been playing with mediawiki for past 6 months and I am getting more
and more comfortable with it and I like it a lot. Now I am thinking to
start
writing extensions for mediawiki starting from very simple (Hello world
types) extensions. I am familiar with PHP and have done some LAMP based
database driven websites.
Can someone recommend a good source/pointers from where I can start
learning
on how to write extensions? Also I would like to know what is the simplest
extension (based on lines of code) for mediawiki that is currently
available
so that I can look at the source code and learn from it too.
Thanks
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l