MediaWiki tips and tricks
|
Philosophy:
- There should be exactly one source for each bit of content
- Sources must be meticulously tracked and audited
- Work should create content, not tools to support the content
[edit] Image caption obtained from image page
Normally, the caption for an image is specified as part of thetag.
]
In many cases, it makes sense to keep the caption with the image. This means that even if the same image is used in several places, any changes to the caption are automatically applied wherever it is used.
This is accomplished by making the image's page a template, and using the <nowiki><includeonly></nowiki> tag to restrict what is used as the template.
For example, consider the image Image:AS17-Flag shots.jpg. A typical reference to the image would be
[[Image:AS17-Flag shots.jpg|thumb|200px|This caption text was specified here.]]
This gives the image with caption at right.
Now, suppose the image's description page has the following wikitext:
<onlyinclude>Cernan and Schmitt at the start of EVA-1 (Not exactly a NASA photo)</onlyinclude> Photomontage by [http://www.ehartwell.com Eric Hartwell]. [[Category:Photos]]
We can use the image's page as a template for the caption:
[[Image:AS17-Flag shots.jpg|thumb|200px|{{:Image:AS17-Flag shots.jpg}}]]
This gives the second version at right. Any edits to the caption on the Image:AS17-Flag shots.jpg page are automatically used in any pages that reference the image using this syntax.
[edit] Copying or Moving a MediaWik Wiki
Once you know how, moving a MediaWiki wiki to a new server, or backing up the existing one, is fairly straightforward. Maybe someday somebody will build a single tool that does it all, but for now it's a manual operation.
This procedure works for installations using MySQL and phpMyAdmin:
- Set up a new MediaWiki installation from scratch
- Configure the server or set up a hosting account. You will need:
- Apache or IIS
- PHP5
- MySQL
- Create a directory on the server and upload the mediawiki distribution files. Always start with a default installation so you can use MediaWiki's auto-configuration. This also simplifies troubleshooting.
- Configure the server or set up a hosting account. You will need:
[edit] Using images from Wikimedia Commons
If I start an own commons wiki, how do I setup it, so that my other wikis can use its media? Have a look at Help:Configuration settings#Shared uploads for detailed information
[edit] Shared uploads
- $wgUseSharedUploads - Whether to look in the shared repository if no file of the given name is found in the local repository (for [[Image:..]], [[Media:..]] links). Default value: false
- $wgSharedUploadPath] - Full path on the web server where shared uploads can be found.
- Default value: "http://commons.wikimedia.org/shared/images"
- $wgSharedUploadDBname - DB name with metadata about shared directory.
- Default value: false. "commons"
- $wgSharedUploadDirectory] - Path on the file system where shared uploads can be found.
- Default value: "/var/www/wiki3/images"
- Commons value: "http://upload.wikimedia.org/wikipedia/commons"
- $wgSharedUploadPath] - Full path on the web server where shared uploads can be found.
- $wgFetchCommonsDescriptions] - Set this "true" if you want to integrate media-descriptions, stored in the commonswiki. Default value: false
- If setting this to true, you also need to set a suitable value for $wgRepositoryBaseUrl, the base URL for a repository wiki.
- Default value: "http://commons.wikimedia.org/wiki/Image"
- If setting this to true, you also need to set a suitable value for $wgRepositoryBaseUrl, the base URL for a repository wiki.
Others
- $wgCacheSharedUploads - Cache shared metadata in memcached.
- $wgSharedLatin1 - set true if the repository uses latin1 filenames.
- [ |$wgHashedSharedUploadDirectory] - Whether to hash the shared upload directory.
[edit] Transcluded references
In sites that use references, it's much better to retrieve the <nowiki><ref></nowiki> tag from a single source, such as the image page, rather than having to copy it to each page where it's needed.
Unfortunately, transclusion of Cite.php style references doesn't work properly with the current version.
[edit] How the single source approach works
Consider a simple quotation: Oral History Transcript/Harrison H. Schmitt/Part 2: March 16, 2000 This comes from the wiki page Oral History Transcript/Harrison H. Schmitt/Part 2: March 16, 2000, which is a transcript of the article
- Johnson Space Center Oral History Project, Oral History Transcript: Harrison H. Schmitt 16 March 2000, NASA JSC History Collection, 16 March 2000
<CodeSyntax>[pseudocode,n]==Apollo Flight Journal== (2000) Oral History Transcript/Harrison H. Schmitt/Part 2: March 16, 2000 <afj quote who="Schmitt" src="Oral History 2000">Interestingly enough, somebody just recently has contacted me and they want to put together a journal of that particular phase of the mission, which is not in the Apollo Lunar Surface Journal that Eric Jones put together. So I think we're going to see a Web-based version of that transcript. I can't believe it's going to be of any great interest to anybody, but we'll see. [Laughter]</afj>
- Schmitt
- Interestingly enough, somebody just recently has contacted me and they want to put together a journal of that particular phase of the mission, which is not in the Apollo Lunar Surface Journal [website] that Eric [M.] Jones put together. So I think we're going to see a Web-based version of that transcript. I can't believe it's going to be of any great interest to anybody, but we'll see. [Laughter]
[1] </CodeSyntax>
[edit] Custom image link icon
The icon that's used for a link to an image page is set in the code. Note that you need to change both the icon's image name and size.
Linker.php:<CodeSyntax>[php,631]
$zoomicon = ' '<a href="'.$u.'" class="internal" title="'.$more.'">'.
'<img src="'.$wgStylePath.'/common/images/magnify-Nuvola_apps_kview_24x18.png" ' .
'width="24" height="18" alt="" /></a>- '<img src="'.$wgStylePath.'/common/images/magnify-clip.png" ' .
- 'width="15" height="11" alt="" /></a></div>';
</CodeSyntax>
References
- ↑ Johnson Space Center Oral History Project, Oral History Transcript: Harrison H. Schmitt 16 March 2000, NASA JSC History Collection, 16 March 2000