http://gemologyproject.com/wiki/index.php?title=Coding_Help&feed=atom&action=historyCoding Help - Revision history2024-03-29T02:12:47ZRevision history for this page on the wikiMediaWiki 1.28.0http://gemologyproject.com/wiki/index.php?title=Coding_Help&diff=10164&oldid=prevTim at 23:21, 12 March 20122012-03-12T23:21:43Z<p></p>
<p><b>New page</b></p><div>==Editing==<br />
<br />
This page is designed to give you a quick 'go to' place whenever you need a bit of code to adapt to your own needs. If what you are looking for isn't listed here then please check [http://www.mediawiki.org/wiki/Help:Editing this page] out.<br />
<br />
==Header==<br />
<br />
In order to create headers like the one above, you place two equal signs around your title:<br />
<br />
<nowiki>==Header==</nowiki><br />
<br />
Subheaders receive 3 equal signs<br />
<br />
<nowiki>===Subheaders===</nowiki><br />
<br />
These headers will automatically result in a table of content (TOC) being displayed above the first header (like on this page). Keep in mind that this may be somewhere halfway down the page if this is where the first header is placed. If you don't want a table of content to be displayed you can add <nowiki>__NOTOC__</nowiki> at the top of the page.<br />
<br />
==Widgets==<br />
<br />
In order to plug all kinds of external features such as youtube videos, google maps, vimeo videos etc etc into the wiki we use widgets. More information about widgets can be found [http://www.mediawikiwidgets.org/Widgets_Catalog here]. Below are a few examples you will use a lot:<br />
<br />
===Iframe widget===<br />
<br />
With the iframe widget you can plug any other webpage into the wiki. Simply replace the url that is displayed here with that of the site you want to plug and adjust the parameters width, height and border to your liking.<br />
<br />
<nowiki>{{#Widget:Iframe</nowiki><br />
<br /><br />
<nowiki>|url=http://en.wikipedia.org/wiki/Diamond</nowiki><br />
<br /><br />
<nowiki>|width=700</nowiki><br />
<br /><br />
<nowiki>|height=400</nowiki><br />
<br /><br />
<nowiki>|border=0</nowiki><br />
<br /><br />
<nowiki>}}</nowiki><br />
<br />
Results in: {{#Widget:Iframe<br />
|url=http://en.wikipedia.org/wiki/Diamond<br />
|width=700<br />
|height=400<br />
|border=0<br />
}}<br />
<br />
===Book embedding Widgets===<br />
<br />
====google books====<br />
<br />
This widget can be used to plug Google Books texts into the wiki. Here's how you do this:<br />
<br />
1. Find a book you want to plug, let's say [http://books.google.com/books?id=UmsDAAAAQAAJ this book]. <br />
<br /><br />
2. Copy the url: <nowiki>http://books.google.com/books?id=UmsDAAAAQAAJ</nowiki><br />
<br /><br />
3. Then copy the bit behind 'id=': UmsDAAAAQAAJ<br />
<br /><br />
4. Paste that code in the widget shown below.<br />
<br /><br />
5. Define the width and height.<br />
<br /><br />
<br />
So that you get something that looks like this: <br />
<br /><br />
<nowiki>{{#widget:Google Books</nowiki><br />
<br /><br />
<nowiki>|id=UmsDAAAAQAAJ</nowiki><br />
<br /><br />
<nowiki>|height=750</nowiki><br />
<br /><br />
<nowiki>|width=700}}</nowiki><br />
<br />
Results in: <br />
<br /><br />
{{#widget:Google Books<br />
|id=UmsDAAAAQAAJ<br />
|height=750<br />
|width=700}}<br />
<br /><br />
<br />
====archive.org====<br />
<br />
This widget is the the iframe widget mentioned above with its parameters adapted so that it makes full use of the width of our pages. It can be used to plug online books from archive.org into the wiki. Here's how to do this:<br />
<br />
1. Find a book on archive.org. Let's say... [http://www.archive.org/details/historyofbigbona00wrigrich this book].<br />
<br /><br />
2. On the book page on archive.org, click on 'read online':<br />
<br />
[[File:Archive.jpg|300px|center]]<br />
<br />
3. Copy the url of the page that will pop up and paste it in the widget below:<br />
<br />
<nowiki>{{#widget:Iframe</nowiki><br />
<br /><br />
<nowiki>|url=http://www.archive.org/stream/historyofbigbona00wrigrich#page/2/mode/2up</nowiki><br />
<br /><br />
<nowiki>|width=700</nowiki><br />
<br /><br />
<nowiki>|height=700</nowiki><br />
<br /><br />
<nowiki>|border=0</nowiki><br />
<br /><br />
<nowiki>}}</nowiki><br />
<br />
This will result in:<br />
<br />
{{#widget:Iframe<br />
|url=http://www.archive.org/stream/historyofbigbona00wrigrich#page/2/mode/2up<br />
|width=700<br />
|height=700<br />
|border=0<br />
}}<br />
<br />
===Vimeo Video embedding===<br />
<br />
1. Go the to vimeo video you want to embed.<br />
<br />
2. Copy the number behind vimeo.com/<br />
<br />
3. Paste the number behind the 'id=' in the following widget:<br />
<br />
<nowiki><center>{{#widget:Vimeo|id=20281170}}</center></nowiki><br />
<br />
Which results in: <br />
<br /><br />
<center>{{#widget:Vimeo|id=20281170}}</center><br />
<br />
===Youtube video===<br />
<br />
Another widget is used for youtube videos. Here's how that works. <br />
<br />
1. Copy the url of the youtube video you want to plug. This should look like this: <nowiki>http://www.youtube.com/watch?v=JIpGc-zvVRI</nowiki>. <br /><br />
2. Copy the bit behind the 'v=' which in this case is: 'JIpGc-zvVRI'<br /><br />
3. Paste that code behind the 'id=' in the following widget code:<br />
<br />
<nowiki>{{#widget:YouTube|id=JIpGc-zvVRI}}</nowiki><br />
<br />
Which results in: <br />
<br />
{{#widget:YouTube|id=JIpGc-zvVRI}}<br />
<br />
==Links==<br />
<br />
Linking is one of the most important features of the wiki. There is two possible kinds of links: internal links that refer to other pages on the wiki, and external links which link to other pages on the web.<br />
<br />
Here's the syntax for links in Mediawiki pages:<br />
<br />
Normal internal link: <nowiki>[[Main Page]]</nowiki>, resulting in this: [[Main Page]]<br />
<br />
Internal link with alternative text: <nowiki>[[Main Page|Alt Text]]</nowiki>, resulting in this: [[Main Page|Alt Text]]<br />
<br />
Plain external link: <nowiki>http://www.external_links.com</nowiki>, resulting in this: http://www.external_links.com<br />
<br />
External Link with alternative text: <nowiki>[http://www.external_links.com External link with alternative text]</nowiki>, resulting in this: [http://www.external_links.com External link with alternative text]<br />
<br />
==Image syntax==<br />
<br />
In order to display an image on a page you will first need to [[Special:MultipleUpload|upload]] the image to the wiki. After that is done you can enclose the file name in the proper syntax. Here's an example of the normal image syntax:<br />
<br />
<nowiki>[[File:Name|thumb|center|500px|Normal Image syntax]]</nowiki><br />
<br />
Let's look at each parameter:<br />
<br />
<nowiki>[[File:Name.jpg|</nowiki>'''thumb'''<nowiki>|center|500px|Normal Image syntax]]</nowiki><br />
<br />
Adding '|thumb|' to the line of coding results in an image that is enclosed in a frame with the option of adding a description beneath the image.<br />
<br />
<nowiki>[[File:Name.jpg|thumb|</nowiki>'''center'''<nowiki>|500px|Normal Image syntax]]</nowiki><br />
<br />
The second parameter determines the position of the image on the page. There is 3 possibilities: 'left', 'center' and 'right'.<br />
<br />
<nowiki>[[File:Name.jpg|thumb|center|</nowiki>'''500px'''<nowiki>|Normal Image syntax]]</nowiki><br />
<br />
This number determines the size of the image. Our pages are 700px wide to give you a reference.<br />
<br />
<nowiki>[[File:Name.jpg|thumb|center|500px|</nowiki>'''Normal Image syntax'''<nowiki>]]</nowiki><br />
<br />
The last parameter is the description text which will be displayed beneath the image when you use the thumb tag. <br />
<br />
Here's an example of a thumb image:<br />
<br />
<nowiki>[[Image:Tourm101.jpg|thumb|center|500px|Our logo]]</nowiki><br />
<br />
Which results in:<br />
<br />
[[Image:Tourm101.jpg|thumb|center|500px|Our logo]]<br />
<br />
Apart from thumbs you can also display images without a subscript:<br />
<br />
<nowiki>[[Image:Tourm101.jpg|left|100px]]</nowiki><br />
<br /><br />
<nowiki>[[Image:Tourm101.jpg|right|100px]]</nowiki><br />
<br /><br />
<nowiki>[[Image:Tourm101.jpg|center|100px]]</nowiki><br />
<br />
Results in: <br />
<br />
[[Image:Tourm101.jpg|left|100px]]<br />
<br />
[[Image:Tourm101.jpg|right|100px]]<br />
<br />
[[Image:Tourm101.jpg|center|100px]]<br />
<br />
==Image link==<br />
<br />
You can also turn an image into a link by adding the link=Page Name tag to the syntax:<br />
<br />
<nowiki>[[Image:Tourm101.jpg|center|</nowiki>'''link=Main Page'''<nowiki>|200px]]</nowiki><br />
<br />
Which results in:<br />
<br />
[[Image:Tourm101.jpg|center|link=Main Page|200px]]<br />
<br />
<br />
==Whitespace & enter==<br />
<br />
Whenever you need a whitespace because you think things are too packed together you can use several <nowiki><br /></nowiki> tags. Each <nowiki><br /></nowiki> tag will equal one 'enter'.<br />
<br />
==Tables==<br />
<br />
For more information on tables, [http://www.mediawiki.org/wiki/Help:Tables click here].<br />
<br />
Here's some basic tables:<br />
<br />
<nowiki>{|class="wikitable"</nowiki><br />
<br /><br />
<nowiki>|-</nowiki><br />
<br /><br />
<nowiki>!header</nowiki><br />
<br /><br />
<nowiki>|-</nowiki><br />
<br /><br />
<nowiki>|text</nowiki><br />
<br /><br />
<nowiki>|text</nowiki><br />
<br /><br />
<nowiki>|-</nowiki><br />
<br /><br />
<nowiki>|text</nowiki><br />
<br /><br />
<nowiki>|text</nowiki><br />
<br /><br />
<nowiki>|}</nowiki><br />
<br />
Which results in:<br />
<br />
{|class="wikitable"<br />
|-<br />
!header<br />
|-<br />
|text<br />
|text<br />
|-<br />
|text<br />
|text<br />
|}<br />
<br />
A table with a header:<br />
<br />
<nowiki>{|class="wikitable"</nowiki><br />
<br /><br />
<nowiki>|-</nowiki><br />
<br /><br />
<nowiki>!colspan="2"|header</nowiki><br />
<br /><br />
<nowiki>|-</nowiki><br />
<br /><br />
<nowiki>|text</nowiki><br />
<br /><br />
<nowiki>|text</nowiki><br />
<br /><br />
<nowiki>|-</nowiki><br />
<br /><br />
<nowiki>|text</nowiki><br />
<br /><br />
<nowiki>|text</nowiki><br />
<br /><br />
<nowiki>|}</nowiki><br />
<br />
Which results in: <br />
<br />
{|class="wikitable"<br />
|-<br />
!colspan="2"|header<br />
|-<br />
|text<br />
|text<br />
|-<br />
|text<br />
|text<br />
|}<br />
<br />
A table with width defined:<br />
<br />
<nowiki>{|class="wikitable" width=80%</nowiki><br />
<br /><br />
<nowiki>|-</nowiki><br />
<br /><br />
<nowiki>|text</nowiki><br />
<br /><br />
<nowiki>|text</nowiki><br />
<br /><br />
<nowiki>|-</nowiki><br />
<br /><br />
<nowiki>|text</nowiki><br />
<br /><br />
<nowiki>|text</nowiki><br />
<br /><br />
<nowiki>|}</nowiki><br />
<br />
Which results in:<br />
<br />
{|class="wikitable" width=80%<br />
|-<br />
|text<br />
|text<br />
|-<br />
|text<br />
|text<br />
|}<br />
<br />
==Centering bits of text==<br />
<br />
You can center tables, text, widgets etc by enclosing it in between center tags: <nowiki><center>text</center></nowiki> <br />
<br /><br />
Resulting in:<br />
<br /><br />
<center>text</center></div>Tim