User:Micke/Sandbox

Interwiki länkar (ofta även kallade IW-länkar) är länkar till sidor på andra projekt som görs genom att man lägger ett prefix framför en vanlig wikilänk (en länk skapade med hakparanteser).

Interwiki länkar gör det möjligt att länka mellan till exempel Wikipedia, Wikibooks, Wikinews (eller mellan olika språkupplagor av samma projekt, se [[Manual:Wiki family]).

En länk som denna:  kommer att se ut så här:Main Page och genom att klicka på länken kommer du i det här fallet till engelska Wikipedias huvudsida. Eller snarare du skulle komma dit om "Wikipedia:" eller ett liknande prefix var en av de intewikiprefix som är påslagna i grundinställningarna. För sök med  i stället : Main Page.

For setting up interwiki links, you might need to edit the database. If you don't want to, you can use Extension:Special page to work with the interwiki table.

Default
Several Wikimedia-Projects (and others) are ready for interwiki linking by default, so you can use them without editing your database. However, the mother of all Wikimedia-projects &mdash; Wikipedia itself &mdash; is still missing, after all these years. It's a bit like the main roads in large cities around the world that go for generations without any street signs.

So here is how to add it...

(note: advanced mySQL users may prefer to use just a single command line: INSERT INTO interwiki SET iw_prefix='(the wiki name)', iw_url='http://(the adequate URL)/$1', iw_local=1, iw_trans=0 ; - instead of exporting and re-importing the whole table interwiki content... )
 * Export the database table 'interwiki' then add to the end of the table the following example...


 * ('en', 'http://en.wikipedia.org/wiki/$1', 1, 0);


 * Note: in the above code, the semicolon ';' as seen, MUST be at the end of the table. At the end of any other line within that table Only has ','.


 * Import the database table 'interwiki'


 * Next: Goto your site, create an article, with the following content.


 * Main_Page will display a link of Main_page and when click on, will go to the url http://en.wikipedia.org/wiki/Main_Page

The following is general interwiki linking.

Note: In some installations none of these is pre-installed. Try  in this case.

Adding more
As the Wikipedia isn't set up by default, you might want to add it (and other projects of your need).

You have to edit your own database. Go to table  and add a new line (usually done with phpMyAdmin):
 *  : choose a prefix, which is used for interwiki linking, e.g. "wikipedia" for linking to Wikipedia
 *  : enter the project's URL, e.g.  for Wikipedia. Don't forget the   as it is replaced with the article's name you are linking to (  links to  ).

That won't work because you have to enter it as binary (bug?), So you have (or not) to add the url in a plain text file, then import it through phpmyadmin. this applies to SVN.
 *  : if 1, your wiki will redirect even external links of the form iw_prefix:title, not only those from its own pages. you need this if you want to use the redirect functionality from outside your wiki or other wikis use your transwiki functions for nested transwiki links (like http://en.wikipedia.org/wiki/fr:Accueil)
 *  : "transwiki transclusion" - set to 1 if you want to use pages from the other wiki as templates. You will also need to set $wgEnableScaryTranscluding = true in your LocalSettings.php

Interwiki links to other languages
If you have installed a Wiki family, you can link from an article in English to an article in German (if you have a German project, too). You can set up MediaWiki, to show those links in the sidebar, just below the toolbox.

In your filesystem, there is a subfolder of your MediaWiki installation, called "languages". Go there and have a look at " " as it contains a list of known languages and their prefixes. E.g. you want to add your German project, search " " for "Deutsch" and note the prefix "de".

If you know the "right" prefix, edit your database by adding a new line to table :
 *  : language-prefix (e.g. "de" for German), which is listed in " "
 *  : URL to your wiki-project (e.g. )
 *  : same as above "Adding More"
 *  : same as above "Adding More"

Now, you can link an article to the same in other languages. Adding  on your english Main_Page will create a link "Deutsch" below the toolbox, which leads to the Main_Page of the German wiki (Hauptseite).

Note, that this link is shown in Sidebar's section, only, and not inside of the article. If you want to create a link inside of the text, you have to add a colon previous to the prefix:.

Interwiki linking Category:Interwiki