Difference between revisions of "Dynamic Navigation"

From Organic Design wiki
Line 4: Line 4:
 
{{Dynamic navigation
 
{{Dynamic navigation
 
|BGCOLOR=#ffcccc
 
|BGCOLOR=#ffcccc
|TITLE=Add these CSS rules to [[MediaWiki:Common.css]]
+
|TITLE=Add these CSS rules to '''MediaWiki:Common.css'''
 
|CONTENT=<css>
 
|CONTENT=<css>
 
div.Boxmerge,
 
div.Boxmerge,
Line 62: Line 62:
 
|EXT=NavOnce
 
|EXT=NavOnce
 
}}
 
}}
 
  
 
{{Dynamic navigation
 
{{Dynamic navigation
 
|BGCOLOR=#ccffcc
 
|BGCOLOR=#ccffcc
|TITLE=Add this JavaScript to [[MediaWiki:Common.js]]
+
|TITLE=Add this JavaScript to '''MediaWiki:Common.js'''
 
|CONTENT=<js>
 
|CONTENT=<js>
 
// for backwards compatibility
 
// for backwards compatibility
Line 265: Line 264:
 
|EXT=NavOnce
 
|EXT=NavOnce
 
}}
 
}}
 
  
 
{{Dynamic navigation
 
{{Dynamic navigation
 
|BGCOLOR=#ccccff
 
|BGCOLOR=#ccccff
|TITLE=Create the [[Template:DynamicNavigation]] containing this wikitext
+
|TITLE=Create the '''Template:DynamicNavigation''' containing this wikitext
 
|CONTENT=<pre>
 
|CONTENT=<pre>
 
<div style="clear:both;text-align:center;{{#if:{{{WIDTH|}}}|width:{{{WIDTH}}}| }};margin:auto;"  align="center" class="NavFrame {{{EXT|}}}">
 
<div style="clear:both;text-align:center;{{#if:{{{WIDTH|}}}|width:{{{WIDTH}}}| }};margin:auto;"  align="center" class="NavFrame {{{EXT|}}}">
Line 289: Line 287:
 
   WIDTH  = Optional parameter to limit width
 
   WIDTH  = Optional parameter to limit width
 
   EXT    = Optional extentions [space seperated list. case-sensitive] so far only NavOnce
 
   EXT    = Optional extentions [space seperated list. case-sensitive] so far only NavOnce
       EXT=NavOnce    =    only allow one navbox with this extention visible at a time (closes other one's)</pre>
+
       EXT=NavOnce    =    only allow one navbox with this extention visible at a time (closes other one's)
 +
</pre><tt>&lt;/pre></tt><pre>
 
</noinclude>
 
</noinclude>
 
</pre>
 
</pre>
Line 295: Line 294:
 
|EXT=NavOnce
 
|EXT=NavOnce
 
}}
 
}}
 
== Language Preference ==
 
I've made this quick extension, [[OD:Extension:ExtraMagic.php|ExtraMagic]], which will add some useful magic words including the current users name, language pref and skin pref. They are accessed with the following magic words:
 
<pre>
 
{{CURRENTUSER}}
 
{{CURRENTLANG}}
 
{{CURRENTSKIN}}
 
</pre>
 
 
If you also install [[MW:Extension:ParserFunctions|ParserFunctions]] then you can then do conditional content based on lang pref, for example:
 
<pre>
 
<div class="{{#ifeq:{{CURRENTLANG}}|en|english-example|other-langs}}">
 
</pre>
 
 
which would give the following for english users
 
<pre>
 
<div class="english-example">
 
</pre>
 
 
or this for everyone else
 
<pre>
 
<div class="other-langs">
 
</pre>
 

Revision as of 02:06, 19 June 2008

Show/Hide Boxes

This method is from [Page|Wiki News front page], it involves three parts, CSS styles, JavaScript code and a template, which follow here: