Difference between revisions of "MediaWiki Tips"

From its-wiki.no
Jump to: navigation, search
(Date and time)
 
(40 intermediate revisions by the same user not shown)
Line 1: Line 1:
Tips and Tricks for MediaWiki
+
__NOTOC__
 +
[[Title::Tips and Tricks for MediaWiki, incl. Math, Date/Time]]<p>
 +
see also [[BasicInternet:How_to_edit]], [[MediaWiki_Design]], [[Ask]]
 
= Date and time =
 
= Date and time =
 
{{#switchtablink:Math|Click here to go to the next tab...}}
 
{{#switchtablink:Math|Click here to go to the next tab...}}
Line 10: Line 12:
 
https://www.mediawiki.org/wiki/Help:Magic_words
 
https://www.mediawiki.org/wiki/Help:Magic_words
 
<pre>
 
<pre>
<span style="float: right; font-size: 80%;" > {{REVISIONMONTH}}.{{REVISIONYEAR}}  </span>
+
<span style="float: right; font-size: 80%; font-weight: bold;" > {{REVISIONMONTH}}.{{REVISIONYEAR}}  </span>
 
{{#formatdate:dec 25,2009|dmy}}
 
{{#formatdate:dec 25,2009|dmy}}
 
</pre>
 
</pre>
  
 +
see also Template:Right, '''Right80,''' {{Small|Small text}}, {{Large|Large text}}, text Colour: {{Colour|blue|blue text }}, {{Colour|red|red text }},
  
see more in [[Ask]]...
+
<pre>
 +
{{Colour|blue|blue text }}, {{Colour|red|red text }}, {{Large|Large text}}
 +
</pre>
  
 +
 +
see more in [[Ask]]...
  
 
= Math =
 
= Math =
Line 32: Line 39:
 
== Style ==
 
== Style ==
 
<pre>
 
<pre>
__NOTOC__
+
__NOTOC__ eller {{TOCright}}
 
__NOEDITSECTION__
 
__NOEDITSECTION__
  
 
<span style="float: right; font-size: 80%;" > your text here </span>
 
<span style="float: right; font-size: 80%;" > your text here </span>
 +
<br/>
 +
<span style="background-color: #ffffcc" > need documentation here </span>
 
</pre>
 
</pre>
NOTITLE on pages is achieved by: (see Template:Lecture)
+
NOTITLE on pages is achieved by: (see [[Template:Lecture]])
 
<pre>
 
<pre>
 
{{DISPLAYTITLE:<span style="position: absolute; clip: rect(1px 1px 1px 1px); clip: rect(1px, 1px, 1px, 1px);">{{FULLPAGENAME}}</span>}}
 
{{DISPLAYTITLE:<span style="position: absolute; clip: rect(1px 1px 1px 1px); clip: rect(1px, 1px, 1px, 1px);">{{FULLPAGENAME}}</span>}}
Line 43: Line 52:
  
 
Span style attributes
 
Span style attributes
  text-align:center;
+
  text-align:center;   # note: centered text through <div class="center" style="font-size:180%; font-weight: bold"> centered </div>
 
  background:color:#ffffee
 
  background:color:#ffffee
 +
font-weight: bold;
  
 
== Images ==
 
== Images ==
Line 57: Line 67:
 
== References ==
 
== References ==
 
<pre>
 
<pre>
<ref>  </ref> and  
+
<ref>  </ref> and or <ref name="Noll2015">
 
<references />
 
<references />
 
</pre>
 
</pre>
  
The first part will just include a reference, the second one with the ''name= ...'' is used to label the references.  You may also group references for sorting after e.g. footnotes and references. a good method for the summary is the use of the template <pre>  {{Reflist}} </pre>
+
The first part will just include a reference, the second one with the ''name= ...'' is used to label the references.  Multiple use of references is used by <pre> <ref name="Noll2015"/> </pre>. You may also group references for sorting after e.g. footnotes and references. a good method for the summary is the use of the template <pre>  {{Reflist}} </pre>
  
 
For further reading, see: [http://www.mediawiki.org/wiki/Extension:Cite/Cite.php Extension:Cite]
 
For further reading, see: [http://www.mediawiki.org/wiki/Extension:Cite/Cite.php Extension:Cite]
Line 75: Line 85:
 
show command: .... {{#show: Afficher des miniatures avec MediaWiki|?Miniature}}
 
show command: .... {{#show: Afficher des miniatures avec MediaWiki|?Miniature}}
  
 +
= Slideshow =
 
Ask on courses in Slideshow mode  (other parameters: limit = 10)
 
Ask on courses in Slideshow mode  (other parameters: limit = 10)
  
Line 82: Line 93:
 
| ?Lecturer
 
| ?Lecturer
 
| ?News
 
| ?News
 +
| ?Objective
 +
| ?Keywords
 
| format=slideshow
 
| format=slideshow
 
| template=Slideshow_courses
 
| template=Slideshow_courses
Line 90: Line 103:
 
| effect=slide left
 
| effect=slide left
 
  }}
 
  }}
 +
=== External Images ===
 +
enabled, use the following for adding a caption
 +
<pre>
 +
{|
 +
| <image URL>
 +
|-
 +
| caption
 +
|}
 +
</pre>
  
= sub-pages =
+
= sub-pages, inclusion =
 
a sub-page is a child page to a topic, example [[UNIK4700/Introduction]], where introduction is a sub-page of UNIK4700. The feature is currently not implemented on this wiki, mainly due to ''(i)'' don't know how to create and ''(ii)'' don't know how to query. Need to look into it.
 
a sub-page is a child page to a topic, example [[UNIK4700/Introduction]], where introduction is a sub-page of UNIK4700. The feature is currently not implemented on this wiki, mainly due to ''(i)'' don't know how to create and ''(ii)'' don't know how to query. Need to look into it.
 
* Create: by adding “query string=super_page=Research” to the form.
 
* Create: by adding “query string=super_page=Research” to the form.
Line 98: Line 120:
  
 
Look also for ParserFunctions extension, they allow to give back parts of the header
 
Look also for ParserFunctions extension, they allow to give back parts of the header
 +
 +
Rather use inclusion of other pages, either through
 +
* <nowiki> {{Assignments}} </nowiki> calling the Template:Assignments or through
 +
* <nowiki> {{:Unik4700:Assignments}} </nowiki> including page [[UNIK4700:Assignments]]
 +
= Collapsing =
 +
=Collapsing a section<span class="mw-customtoggle-0" style="font-size:small; display:inline-block"><span class="mw-customtoggletext">[Show/hide]</span></span>=
 +
<div  id="mw-customcollapsible-0" class="mw-collapsible mw-collapsed">
 +
this is the text for Section 1
 +
 +
and more text </div>
 +
== Collapsing tables==
 +
https://en.wikipedia.org/wiki/Help:Collapsing
 +
{| class="wikitable mw-collapsible mw-collapsed"
 +
|+class="nowrap" | Winter Olympic Games
 +
|-
 +
|
 +
! scope="col" | City
 +
! scope="col" | Country
 +
|-
 +
! scope="row" | 1994
 +
| Lillehammer || Norway
 +
|-
 +
! scope="row" | 1998
 +
| Nagano || Japan
 +
|}
  
 
=Semantic Bundle=
 
=Semantic Bundle=
Line 124: Line 171:
 
$ sudo chown -R www-data:www-data *
 
$ sudo chown -R www-data:www-data *
 
</pre>
 
</pre>
 
  
 
=Widgets=
 
=Widgets=
Line 139: Line 185:
  
  
other widgets: [http://www.mediawikiwidgets.org/w/index.php?
+
other widgets: [http://www.mediawikiwidgets.org/w/index.php?title=Special:AllPages&from=&namespace=274 mediawiki widgets]
title=Special:AllPages&from=&namespace=274 mediawiki widgets]
+
 
* LinkedIN widget: [[Test_LinkedIn_Profile]]
 
* LinkedIN widget: [[Test_LinkedIn_Profile]]
 
* Youtube: [[YouTubeWidget-test]]
 
* Youtube: [[YouTubeWidget-test]]
  
 
= Language =
 
= Language =
 +
We are using the the specific ending /NO for a norwegian page of an existing pagename, and the flag, check http://BasicInternet.org
 +
----
 +
'''depreciated'''
 
29Jan2014: Language settings is not working - after upgrade to Mediawiki 1.22.1
 
29Jan2014: Language settings is not working - after upgrade to Mediawiki 1.22.1
 
14Feb2013: playing with language functions to test en/no implementation
 
14Feb2013: playing with language functions to test en/no implementation
Line 165: Line 213:
  
 
this is a header in English}}
 
this is a header in English}}
=={{#iflang: en |English heading }}{{#iflang: no |Norsk titel }}==
+
<nowiki> =={{#iflang: en |English heading }}{{#iflang: no |Norsk titel }}== </nowiki>
 +
 
 +
= Buttons =
 +
So for meetings you use the following:
 +
<nowiki>
 +
{{#formlink:form=Meeting|link text=Add a meeting|link type=button|namespace=Basic Internet}}
 +
</nowiki>
 +
 
 +
This gives you an '''Add a meeting button'''.
 +
 
 +
The one step process is useful because you can also pass values into the form. For example, if you are creating a meeting from within a project page, you could pass the project value in automatically by adding to the Project template:
 +
<nowiki> {{#formlink:form=Meeting|link text=Add a meeting|link type=button|namespace=Basic Internet|query string=Meeting[Project]={{PAGENAME}}}} </nowiki>
 +
 
 +
I would also add another category to the Meetings e.g. <nowiki> [[Category:Basic Internet Meetings]] </nowiki>". You can then easily query them. You can also do clever things like assign the category using the parameter passing above. So you can start categorising the meetings based on where in the site they are created.
  
 
= Add-on functionality =
 
= Add-on functionality =
Line 197: Line 258:
 
http://clkoerner.com/tag/mediawiki/
 
http://clkoerner.com/tag/mediawiki/
  
<headertabs/>
+
= Footer=
 +
Combine the footer with the semantic bottrom
 +
 
 +
To put this into your other skins you will need to copy the iotsec_footer and bif_footer CSS from /var/www/mediawiki/skins/iotsec_template.css to the corresponding file in the other skins.
 +
 
 +
Then you need to add:
 +
<pre><css>.catlinks {display:none}<css/></pre>
 +
to the templates where you want to have the new footer box.
 +
<!---- <headertabs/> --->
  
 
= Design =
 
= Design =
[[Mediawiki Design]] lists cool designs suggestions. We are using the GuMax Design, and our package can be downloaded from [[Media:GuMax-UNIK.tar.gz]]
+
[[Mediawiki Design]] lists cool designs suggestions. We are using the GuMax Design, and our package can be downloaded from [[Media:GuMax-UNIK.tar.gz]] - Our update towards the Basic Internet skin and the IoTSec skin were dann by [[Neill Mitchell]] from [[Prescient Software]]  
 
[[Category:IT-help]]
 
[[Category:IT-help]]

Latest revision as of 17:25, 8 March 2021

Tips and Tricks for MediaWiki, incl. Math, Date/Time

see also BasicInternet:How_to_edit, MediaWiki_Design, Ask

Date and time

Click here to go to the next tab... Example:

  • CURRENTYEAR is 2024, CURRENTTIME is 18:08, LOCALTIME is 18:08
  • date: 25 Dec 2009 or "now": 30 Apr 2024
  • Revision: 03.2021
  • DueDate used for Master thesis delivery, Due_date used for project and other deliverables

https://www.mediawiki.org/wiki/Help:Magic_words

<span style="float: right; font-size: 80%; font-weight: bold;" > {{REVISIONMONTH}}.{{REVISIONYEAR}}  </span>
{{#formatdate:dec 25,2009|dmy}}

see also Template:Right, Right80, Small text, Large text, text Colour: blue text , red text ,

{{Colour|blue|blue text }}, {{Colour|red|red text }}, {{Large|Large text}}


see more in Ask...

Math

 <math> x^2 + y^2 = z^2 </math> 

for easy text formatting, you can also use the NO<sub>2</sub> writing, which provides NO2.

Header Tabs

put the word <headertabs/> at the end of the part which is separated in Tabs, and then header 1 will be converted into a tab.

Read more at: http://www.mediawiki.org/wiki/Extension:Header_Tabs

TOC, Style and Images

Style

__NOTOC__ eller {{TOCright}}
__NOEDITSECTION__

<span style="float: right; font-size: 80%;" > your text here </span>
<br/>
<span style="background-color: #ffffcc" > need documentation here </span>

NOTITLE on pages is achieved by: (see Template:Lecture)

{{DISPLAYTITLE:<span style="position: absolute; clip: rect(1px 1px 1px 1px); clip: rect(1px, 1px, 1px, 1px);">{{FULLPAGENAME}}</span>}}

Span style attributes

text-align:center; # note: centered text through
centered
background:color:#ffffee
font-weight: bold;

Images

  • right flow, 350 px, with frame and caption

[[File:image.png|350px|frame|Caption of image|link=http://cwi.unik.no/wiki/UNIK4700]]

  • external images, just include the http link

Logo.gif http://www.unik.no/Images/Logo.gif

References

<ref>   </ref> and or <ref name="Noll2015">
<references />
The first part will just include a reference, the second one with the name= ... is used to label the references. Multiple use of references is used by
 <ref name="Noll2015"/> 
. You may also group references for sorting after e.g. footnotes and references. a good method for the summary is the use of the template
  {{Reflist}} 

For further reading, see: Extension:Cite

Miniature of pages

http://www.robothumb.com/src/http://www.monsite.fr@160x120.jpg

www.monsite.fr@160x120.jpg

wiki.unik.no@320x240.jpg


show command: ....

Slideshow

Ask on courses in Slideshow mode (other parameters: limit = 10)

External Images

enabled, use the following for adding a caption

{|
| <image URL>
|-
| caption
|}

sub-pages, inclusion

a sub-page is a child page to a topic, example UNIK4700/Introduction, where introduction is a sub-page of UNIK4700. The feature is currently not implemented on this wiki, mainly due to (i) don't know how to create and (ii) don't know how to query. Need to look into it.

  • Create: by adding “query string=super_page=Research” to the form.
  • a good article on search in sub-pages and omnitting the "main" page:

http://clkoerner.com/2012/09/06/semantic-mediawiki-templates-and-arraymaps-are-awesome/

Look also for ParserFunctions extension, they allow to give back parts of the header

Rather use inclusion of other pages, either through

  • {{Assignments}} calling the Template:Assignments or through
  • {{:Unik4700:Assignments}} including page UNIK4700:Assignments

Collapsing

Collapsing a section[Show/hide]

this is the text for Section 1

and more text

Collapsing tables

https://en.wikipedia.org/wiki/Help:Collapsing

Winter Olympic Games
City Country
1994 Lillehammer Norway
1998 Nagano Japan

Semantic Bundle

  • 3Jan2012 tried compilation again, having renamed SemanticBundle to semantic-bundle
  • sudo make all worked
  • failed at the end, 7z not found, but SemanticBundle-20130103.tgz was created > moved to extensions > tar xvf SemanticBundle-20130103.tgz > created "all extensions"
    • SemanticResultFormats
    • SemanticSignup
    • SemanticTasks
    • SemanticWatchlist
    • SemanticDrilldown
    • ...
    • Widgests
    • Maps
    • Nuke
    • PageSchemas
    • ParserFunctions

Activated through

$ pwd
/var/www/mediawiki/extensions/semantic-bundle
$ sudo vi SemanticBundle.php
$ sudo cp SemanticBundleSettings.sample.php SemanticBundleSettings.php
$ sudo vi SemanticBundleSettings.php
$ sudo chown -R www-data:www-data *

Widgets

See a list of Widgets used on this wiki

YouTube widget

{{#widget:WidgetName|param1=value1|param2=value2}}
{{#widget:YouTube|id=DWef69ItVrU}}
  • id - video id (from the URL)
  • playlist - playlist name (starts with PL) - first clip is played (id is ignored)
  • height and width define view dimensions, 420x350 is default


other widgets: mediawiki widgets

Language

We are using the the specific ending /NO for a norwegian page of an existing pagename, and the flag, check http://BasicInternet.org


depreciated 29Jan2014: Language settings is not working - after upgrade to Mediawiki 1.22.1 14Feb2013: playing with language functions to test en/no implementation

  • Don't forget to run a "page refresh" (as cache is enabled)
{{#iflang: no |
 dette er en norsk tekst 
 }}
 {{#iflang: en | 
 Secret stuff for english speakers 
 }}
 Here's a bilingual header.
  =={{#iflang: en |English heading }}{{#ifmultlang: }}{{#iflang: no |Norsk titel }}==

{{#iflang: no |Dette er en norsk tekst

Og her kommer en header på norsk}} {{#iflang: en |Secret stuff for english speakers

this is a header in English}} =={{#iflang: en |English heading }}{{#iflang: no |Norsk titel }}==

Buttons

So for meetings you use the following: {{#formlink:form=Meeting|link text=Add a meeting|link type=button|namespace=Basic Internet}}

This gives you an Add a meeting button.

The one step process is useful because you can also pass values into the form. For example, if you are creating a meeting from within a project page, you could pass the project value in automatically by adding to the Project template: {{#formlink:form=Meeting|link text=Add a meeting|link type=button|namespace=Basic Internet|query string=Meeting[Project]={{PAGENAME}}}}

I would also add another category to the Meetings e.g. [[Category:Basic Internet Meetings]] ". You can then easily query them. You can also do clever things like assign the category using the parameter passing above. So you can start categorising the meetings based on where in the site they are created.

Add-on functionality


All messages and how to set them Special:AllMessages

SimpleSecurity - removed error message MediaWiki:Security-info (left as blank page)

Dynamic pages

Using the inclusion of Special:RecentChanges or Special:Newpages for recent changes

No changes during the given period matching these criteria.

or

Inclusion of pages works shrough {{:Name_of_page}} for pages from the main namespace, otherwise from Template:Name_of_page

Links to changes - % why don't they work? - Links work in MediaWiki:Sidebar

  • currentevents-url|currentevents
  • recentchanges-url|Recent changes
  • randompage-url|randompage
  • TrackRecord|TrackChanges

See Talk:MediaWiki Tips for information on dynamic sidebars

Interworking Wordpress

Nicely described by Chris Koerner in using the MediaWiki environment that we use to document stuff.¹ Lately I’ve been trying to figure out how to leverage the MediaWiki API and the External Data Extension to manipulate data from external sources and content within the wiki. http://clkoerner.com/tag/mediawiki/

Footer

Combine the footer with the semantic bottrom

To put this into your other skins you will need to copy the iotsec_footer and bif_footer CSS from /var/www/mediawiki/skins/iotsec_template.css to the corresponding file in the other skins.

Then you need to add:

<css>.catlinks {display:none}<css/>

to the templates where you want to have the new footer box.

Design

Mediawiki Design lists cool designs suggestions. We are using the GuMax Design, and our package can be downloaded from Media:GuMax-UNIK.tar.gz - Our update towards the Basic Internet skin and the IoTSec skin were dann by Neill Mitchell from Prescient Software