User:Micke/Sandbox

From mediawiki.org
PD Note: When you edit this page, you agree to release your contribution under the CC0. See Public Domain Help Pages for more info. PD

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: [[Wikipedia:Main Page]] kommer att se ut sĂ„ hĂ€r:Wikipedia: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örsök med [[MetaWikipedia:Main Page]] i stĂ€llet : MetaWikipedia:Main Page.

För att slÄ pÄ möjligheten att göra interwiki lÀnkar, kan du behöva Àndra i databasen. Om du inte vill göra det kan du anvÀnda de engelska instruktionerna pÄ denna sida.

Interwiki lÀnkar till andra projekt[edit]

GrundinstÀllning[edit]

Flera Wikimedia-Projekt (och Àven andra) Àr redo för interwiki lÀnkning redan genom grundinstÀllningarna, sÄ du kan lÀnka utan att Àndra i databasen. Dock saknas Wikimedias största projekt Wikipedia i denna grundinstÀllning, efter alla dessa Är. Det Àr som huvudgatorna i stora stÀder som i generation efter generation saknar vÀgskyltar. SÄ hÀr gör du för att rÀtta till detta...
(notera att advancerade mySQLanvĂ€ndare kanske fördrar att anvĂ€nda en enda kommandorad: INSERT INTO interwiki SET iw_prefix='(wikins namn)', iw_url='http://(rĂ€tt URL)/$1', iw_local=1, iw_trans=0 ; - istĂ€llet för att exportera och Ă„ter importera hela tabellens interwiki innehĂ„ll... )

  • Exportera databasens tabell 'interwiki' lĂ€gg sedan till följande exempel i slutet pĂ„ tabellen...
  • ('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.
  • [[en: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.

prefix direction usage example
commons http://commons.wikimedia.org/wiki/ [[commons:MediaWiki]]
mediazilla http://bugzilla.wikimedia.org/ [[mediazilla:1209]]
meta http://meta.wikimedia.org/wiki/ [[meta:Main Page]]
mw http://www.mediawiki.org/wiki/ [[mw:Help:Contents]]
wikibooks http://en.wikibooks.org/wiki/ [[wikibooks:Main Page]]
wikimedia http://wikimediafoundation.org/wiki/ [[wikimedia:Main Page]]
wikinews http://en.wikinews.org/wiki/ [[wikinews:Main Page]]
wikiquote http://en.wikiquote.org/wiki/ [[wikiquote:Main Page]]
wikisource http://en.wikisource.org/wiki/ [[wikisource:Main Page]]
wikispecies http://species.wikimedia.org/wiki/ [[wikispecies:Main Page]]
wiktionary http://en.wiktionary.org/wiki/ [[wiktionary:Main Page]]

Note: In some installations none of these is pre-installed. Try [[metawikipedia:Main Page]] in this case.

Adding more[edit]

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 interwiki and add a new line (usually done with phpMyAdmin):

  • iw_prefix: choose a prefix, which is used for interwiki linking, e.g. "wikipedia" for linking to Wikipedia
  • iw_url: enter the project's URL, e.g. http://en.wikipedia.org/wiki/$1 for Wikipedia. Don't forget the $1 as it is replaced with the article's name you are linking to ([[Wikipedia:Main Page]] links to http://en.wikipedia.org/wiki/Main_Page).

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.

  • iw_local: 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 w:en:fr:Accueil)
  • iw_trans: "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


Tip for wiki admins: Several help pages link to MediaWiki.org's Manual namespace. To make these links work on your local wiki, add an interwiki link with iw_prefix=manual and iw_url=http://www.mediawiki.org/wiki/Manual:$1

Interwiki links to other languages[edit]

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 "Names.php" as it contains a list of known languages and their prefixes. E.g. you want to add your German project, search "Names.php" for "Deutsch" and note the prefix "de".

If you know the "right" prefix, edit your database by adding a new line to table interwiki:

  • iw_prefix: language-prefix (e.g. "de" for German), which is listed in "Names.php"
  • iw_url: URL to your wiki-project (e.g. http://de.your-wiki.org/index.php/$1)
  • iw_local: same as above "Adding More"
  • iw_trans: same as above "Adding More"


Now, you can link an article to the same in other languages. Adding [[de:Hauptseite]] 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: [[:de:Hauptseite]].

Interwiki linking Category:Interwiki