A hierarchical navigation bar can be implemented by changing code in monobook.php ( http://meta.wikimedia.org/wiki/Customization#How_do_I_add_an_editable_Left_M...). Unfortunately this only works in case $wgUseDatabaseMessages in defaultsettings.php is set to "true".
In my case, this variable is set to false, in order to be able to use another language (Dutch instead of English) in our wiki. BUT by setting $wgUseDatabaseMessages=false, the mediawiki-namespace (into which the navigation bar has to be changed) is not read anymore.
To change the content of the navigation bar, I had to adapt the language.phpfile:
'sidebar' => ' * navigation ** mainpage|mainpage ** portal-url|portal ** currentevents-url|currentevents ** recentchanges-url|recentchanges ** randompage-url|randompage ** helppage|help * Cases ** Businesscase|Business ** Technicalcase|Technical ',
but i cannot implement a hierarchical menu by changing e.g. ** Technicalcase|Technical into *** Technicalcase|Technical. Does anyone know how to solve this problem so that I can implement a hierarchical menu while $wgUseDatabaseMessages=false? Do I have to change code in the language.php file or in the monobook.phpfile?
Thanks in advance! Birger
2006/3/24, Jama Poulsen jama@debianlinux.net:
On Thu, Mar 23, 2006 at 10:05:57AM +0100, Birger wrote:
Does anyone know whether it is possible to implement a hierarchical navigation bar in Mediawiki like e.g.:
- CASES
** BUSINESSCASES-URL | BUSINESSCASES *** BCASE1-URL | CASE1 *** BCASE2-URL | CASE2 ** TECHNICALCASES-URL | TECHNICALCASES *** TCASE1-URL | CASE1 *** TCASE2-URL | CASE2
I think it would be easiest to just edit the skin files (eg. /wiki/skins/MonoBook.php) with some extra CSS and/or JS that implements such a structure.
Doing this dynamically (from the Wiki text) isn't so easy in the MW interface.
Jama Poulsen _______________________________________________ Wikitech-l mailing list Wikitech-l@wikimedia.org http://mail.wikipedia.org/mailman/listinfo/wikitech-l
On 28/03/06, Birger bweynants@gmail.com wrote: [...]
but i cannot implement a hierarchical menu by changing e.g. ** Technicalcase|Technical into *** Technicalcase|Technical. Does anyone know how to solve this problem so that I can implement a hierarchical menu while $wgUseDatabaseMessages=false? Do I have to change code in the language.php file or in the monobook.phpfile?
You'll need to edit the skin so it renders the sidebar in the manner desired; this means altering the correct skin file depending upon the skin in use. The default skin is Monobook, but be aware that users can select another in their preferences.
Rob Church
You'll need to edit the skin so it renders the sidebar in the manner desired;
I tried to edit the skin, but the problem is that I cannot refer to a navigation-layout-page I made in the mediawiki-namespace (because I had to set $wgUseDatabaseMessages=false). I think the solutions lies in referring to a navigation-layout-page that is not in the mediawiki-namespace, but I don't know how to do that. The explanation given on http://meta.wikimedia.org/wiki/Layout_customization#How_do_I_add_an_editable... only point out a solution in case $wgUseDatabaseMessages=true....
2006/3/28, Rob Church robchur@gmail.com:
On 28/03/06, Birger bweynants@gmail.com wrote: [...]
but i cannot implement a hierarchical menu by changing e.g. ** Technicalcase|Technical into *** Technicalcase|Technical. Does anyone
know
how to solve this problem so that I can implement a hierarchical menu while $wgUseDatabaseMessages=false? Do I have to change code in the language.php file or in the
monobook.phpfile?
You'll need to edit the skin so it renders the sidebar in the manner desired; this means altering the correct skin file depending upon the skin in use. The default skin is Monobook, but be aware that users can select another in their preferences.
Rob Church _______________________________________________ Wikitech-l mailing list Wikitech-l@wikimedia.org http://mail.wikipedia.org/mailman/listinfo/wikitech-l
On Tue, 28 Mar 2006 14:36:08 +0200 Birger bweynants@gmail.com wrote:
A hierarchical navigation bar can be implemented by changing code in monobook.php ( http://meta.wikimedia.org/wiki/Customization#How_do_I_add_an_editable_Left_M...). Unfortunately this only works in case $wgUseDatabaseMessages in defaultsettings.php is set to "true".
In my case, this variable is set to false, in order to be able to use another language (Dutch instead of English) in our wiki. BUT by setting $wgUseDatabaseMessages=false, the mediawiki-namespace (into which the navigation bar has to be changed) is not read anymore.
To change the content of the navigation bar, I had to adapt the language.phpfile:
'sidebar' => '
- navigation
** mainpage|mainpage ** portal-url|portal ** currentevents-url|currentevents ** recentchanges-url|recentchanges ** randompage-url|randompage ** helppage|help
- Cases
** Businesscase|Business ** Technicalcase|Technical ',
but i cannot implement a hierarchical menu by changing e.g. ** Technicalcase|Technical into *** Technicalcase|Technical. Does anyone know how to solve this problem so that I can implement a hierarchical menu while $wgUseDatabaseMessages=false? Do I have to change code in the language.php file or in the monobook.phpfile?
Thanks in advance! Birger
If you're using $wgUseDatabaseMessages=false, MediaWiki just gets his messages from Language.php and (in your case) LanguageNl.php. So if you want to change the messages, you can just edit these files. In this case you need to edit the message "Sidebar". Because you're not using database-messages, you can just edit this message in Language.php.
The hack at http://meta.wikimedia.org/wiki/Customization#How_do_I_add_an_editable_Left_M... does not care where the messages come from. If the messages come from the database or from the Language??.php files, both cases work. But only if you've applied the hack of course.
In my case, this variable is set to false, in order to be able to use another language (Dutch instead of English) in our wiki.
Hint: To fill the database with Dutch messages instead of English messages, you can run maintainance/rebuildMessages.php. (keep in mind this does not change the language preferences of the user (every user can set in his/her preferences his/her prefered language, so it's best to test such things as anonymous user). You don't have to, you can just continue using Language??.php files. It makes MediaWiki faster.
Succes, Wilinckx.
--
Thanks a lot for the help! The hierarchical navigation bar is working now ;-)
While playing around with the menu, I encountered some strange behavior though:
1. Whatever I put before the sublevel, is placed automatically above the navigationbox. For example:
'sidebar' => ' * [[Mainpage|Main Page]] * [[Special:Recentchanges|Recent Changes]] * [[Current_events| News]] * [[Help|Help]] * Cases ** [[Technicalcase|Tcase]] ** [[Businesscase|Bcase]] ',
MediaWiki puts then the word "Cases" above the navigationbox. I have tried to put "*navigation" right above "* [[Mainpage|Main Page]] " but unfortunately this does not help. MediaWiki keeps putting the word that is placed right above the sublevel above the box. Why is this done automatically? How could i possibly change this? 2. I wanted to make a second box beneith the navigation box and therefore i had put <?php $this->msgWiki( 'sidebar' ) ?> <?php $this->msgWiki( 'casebar' ) ?> in monobook.php with 'casebar' => ' * Cases ** [[Technicalcase|Tcase]] ** [[Businesscase|Bcase]] ', Unfortunately, MediaWiki joins the two bars together into one box. Is it possible to create two separate boxes? I could separate boxes before (when i did not apply the hackhttp://meta.wikimedia.org/wiki/Layout_customization#How_do_I_add_an_editable_Left_Menu.3F), by just putting "*" before the word that had to appear above the box. I don't see how it is possible to figure that out while applying the hack...
Thanks again for any help!
Birger.
2006/3/28, wilinckx < wilinckx@willempen.org>:
On Tue, 28 Mar 2006 14:36:08 +0200 Birger bweynants@gmail.com wrote:
A hierarchical navigation bar can be implemented by changing code in monobook.php (
http://meta.wikimedia.org/wiki/Customization#How_do_I_add_an_editable_Left_M... ).
Unfortunately this only works in case $wgUseDatabaseMessages in defaultsettings.php is set to "true".
In my case, this variable is set to false, in order to be able to use another language (Dutch instead of English) in our wiki. BUT by setting $wgUseDatabaseMessages=false, the mediawiki-namespace (into which the navigation bar has to be
changed) is
not read anymore.
To change the content of the navigation bar, I had to adapt the language.phpfile:
'sidebar' => '
- navigation
** mainpage|mainpage ** portal-url|portal ** currentevents-url|currentevents ** recentchanges-url|recentchanges ** randompage-url|randompage ** helppage|help
- Cases
** Businesscase|Business ** Technicalcase|Technical ',
but i cannot implement a hierarchical menu by changing e.g. ** Technicalcase|Technical into *** Technicalcase|Technical. Does anyone
know
how to solve this problem so that I can implement a hierarchical menu while $wgUseDatabaseMessages=false? Do I have to change code in the language.php file or in the
monobook.phpfile?
Thanks in advance! Birger
If you're using $wgUseDatabaseMessages=false, MediaWiki just gets his messages from Language.php and (in your case) LanguageNl.php. So if you want to change the messages, you can just edit these files. In this case you need to edit the message "Sidebar". Because you're not using database-messages, you can just edit this message in Language.php.
The hack at http://meta.wikimedia.org/wiki/Customization#How_do_I_add_an_editable_Left_M...
does not care where the messages come from. If the messages come from the database or from the Language??.php files, both cases work. But only if you've applied the hack of course.
In my case, this variable is set to false, in order to be able to use another language (Dutch instead of English) in our wiki.
Hint: To fill the database with Dutch messages instead of English messages, you can run maintainance/rebuildMessages.php. (keep in mind this does not change the language preferences of the user (every user can set in his/her preferences his/her prefered language, so it's best to test such things as anonymous user). You don't have to, you can just continue using Language??.php files. It makes MediaWiki faster.
Succes, Wilinckx.
-- _______________________________________________ Wikitech-l mailing list Wikitech-l@wikimedia.org http://mail.wikipedia.org/mailman/listinfo/wikitech-l
On Wed, 29 Mar 2006 11:20:17 +0200 Birger bweynants@gmail.com wrote:
Thanks a lot for the help! The hierarchical navigation bar is working now ;-)
While playing around with the menu, I encountered some strange behavior though:
- Whatever I put before the sublevel, is placed automatically above
the navigationbox. For example:
'sidebar' => '
- [[Mainpage|Main Page]]
- [[Special:Recentchanges|Recent Changes]]
- [[Current_events| News]]
- [[Help|Help]]
- Cases
** [[Technicalcase|Tcase]] ** [[Businesscase|Bcase]] ',
MediaWiki puts then the word "Cases" above the navigationbox. I have tried to put "*navigation" right above "* [[Mainpage|Main Page]] " but unfortunately this does not help. MediaWiki keeps putting the word that is placed right above the sublevel above the box. Why is this done automatically? How could i possibly change this?
You probably are still having this code: <h5><?php $out = wfMsg( $bar ); if (wfNoMsg($bar, $out)) echo $bar; else echo $out; ?></h5> The $bar variable comes from <?php foreach ($this->data['sidebar'] as $bar => $cont) { ?> and $this->data['sidebar'] comes from the old navigation parse system, which you don't want to use anymore.
What you can do is modify the <h5> line directly, like this: <h5>The Title I Want To Have Above The Box</h5>
This is not clean at all, but it's easy. If you want to do it more cleanly you can instead modify the sidebar-parser, which is the function buildSidebar() in includes/Skin.php
2. I wanted to make a second box beneith the navigation box andtherefore i had put <?php $this->msgWiki( 'sidebar' ) ?> <?php $this->msgWiki( 'casebar' ) ?> in monobook.php with 'casebar' => '
- Cases
** [[Technicalcase|Tcase]] ** [[Businesscase|Bcase]] ', Unfortunately, MediaWiki joins the two bars together into one box. Is it possible to create two separate boxes? I could separate boxes before (when i did not apply the hackhttp://meta.wikimedia.org/wiki/Layout_customization#How_do_I_add_an_editable_Left_Menu.3F), by just putting "*" before the word that had to appear above the box. I don't see how it is possible to figure that out while applying the hack...
In HTML code, a box looks like this:
<div class='portlet' id='p-just-on-or-another-id:'> <h5>The title above the box:</h5> <div class='pBody'> here the content of the box </div> </div>
In the non-hacked MonoBook, this HTML code is inside a loop, so generated multiple times if needed.
What you did is this:
<div class='portlet' id='p-just-on-or-another-id:'> <h5>The title above the box:</h5> <div class='pBody'> here the content of the first box here the content of the second box </div> </div>
What you need is this: <div class='portlet' id='p-just-on-or-another-id:'> <h5>The title above the first box:</h5> <div class='pBody'> here the content of the first box </div> </div> <div class='portlet' id='p-yet-another-id:'> <h5>The title above the second box:</h5> <div class='pBody'> here the content of the second box </div> </div>
ps: this is not 100% the exact code of MonoBook, more to give you the idea. If you can't find out how to change your MonoBook code it's maybe more usefull to paste the part of the code.
Succes,
Wilinckx.
Thanks! Everthing is displayed and working perfectly now ;-)
One thing I do not clearly see is the fact that I had to change sidebar into casebar in includes/skin.php: function buildSidebar() { $fname = 'SkinTemplate::buildSidebar'; wfProfileIn( $fname );
$bar = array(); $lines = explode( "\n", wfMsgForContent( 'casebar' ) ); foreach ($lines as $line) { if (strpos($line, '*') !== 0) continue; if (strpos($line, '**') !== 0) { $line = trim($line, '* '); $heading = $line; } else { if (strpos($line, '|') !== false) { // sanity check $line = explode( '|' , trim($line, '* '), 2 ); $link = wfMsgForContent( $line[0] ); if ($link == '-') continue; if (wfNoMsg($line[1], $text = wfMsg($line[1]))) $text = $line[1]; if (wfNoMsg($line[0], $link)) $link = $line[0]; $bar[$heading][] = array( 'text' => $text, 'href' => $this->makeInternalOrExternalUrl( $link ), 'id' => 'n-' . strtr($line[1], ' ', '-'), ); } else { continue; } } }
I had to do this, apparently since no boxes could be displayed because sidebar does not contain sublevels (it only contains *items and no **items, while casebar does have **items), but I do not understand quite well why exactly I had to change this. I guess it has something to do with f (strpos($line, '**') !== 0) { $line = trim($line, '* '); $heading = $line; but i'm not sure.
In any case, thanks a lot for the help you gave me! I'm really happy it works now :-)
Birger.
2006/3/29, wilinckx wilinckx@willempen.org:
On Wed, 29 Mar 2006 11:20:17 +0200 Birger bweynants@gmail.com wrote:
Thanks a lot for the help! The hierarchical navigation bar is working
now
;-)
While playing around with the menu, I encountered some strange behavior though:
- Whatever I put before the sublevel, is placed automatically above
the navigationbox. For example:
'sidebar' => '
- [[Mainpage|Main Page]]
- [[Special:Recentchanges|Recent Changes]]
- [[Current_events| News]]
- [[Help|Help]]
- Cases
** [[Technicalcase|Tcase]] ** [[Businesscase|Bcase]] ',
MediaWiki puts then the word "Cases" above the navigationbox. I have
tried
to put "*navigation" right above "* [[Mainpage|Main Page]] " but unfortunately this does not help. MediaWiki keeps putting the word that
is
placed right above the sublevel above the box. Why is this done automatically? How could i possibly change this?
You probably are still having this code:
<h5><?php $out = wfMsg( $bar ); if (wfNoMsg($bar, $out)) echo $bar; else echo $out; ?></h5> The $bar variable comes from <?php foreach ($this->data['sidebar'] as $bar => $cont) { ?> and $this->data['sidebar'] comes from the old navigation parse system, which you don't want to use anymore.
What you can do is modify the <h5> line directly, like this:
<h5>The Title I Want To Have Above The Box</h5>
This is not clean at all, but it's easy. If you want to do it more cleanly you can instead modify the sidebar-parser, which is the function buildSidebar() in includes/Skin.php
2. I wanted to make a second box beneith the navigation box andtherefore i had put <?php $this->msgWiki( 'sidebar' ) ?> <?php $this->msgWiki( 'casebar' ) ?> in monobook.php with 'casebar' => '
- Cases
** [[Technicalcase|Tcase]] ** [[Businesscase|Bcase]] ', Unfortunately, MediaWiki joins the two bars together into one box. Is it possible to create two separate boxes? I could separate boxes before
(when i
did not apply the hack<
http://meta.wikimedia.org/wiki/Layout_customization#How_do_I_add_an_editable...
), by just putting "*" before the word that had to appear above the box. I don't see how it is possible to figure that out while applying the
hack...
In HTML code, a box looks like this:
<div class='portlet' id='p-just-on-or-another-id:'> <h5>The title above the box:</h5> <div class='pBody'> here the content of the box </div> </div>
In the non-hacked MonoBook, this HTML code is inside a loop, so generated multiple times if needed.
What you did is this:
<div class='portlet' id='p-just-on-or-another-id:'> <h5>The title above the box:</h5> <div class='pBody'> here the content of the first box here the content of the second box </div> </div>
What you need is this:
<div class='portlet' id='p-just-on-or-another-id:'> <h5>The title above the first box:</h5> <div class='pBody'> here the content of the first box </div> </div> <div class='portlet' id='p-yet-another-id:'> <h5>The title above the second box:</h5> <div class='pBody'> here the content of the second box </div> </div>
ps: this is not 100% the exact code of MonoBook, more to give you the idea. If you can't find out how to change your MonoBook code it's maybe more usefull to paste the part of the code.
Succes,
Wilinckx. _______________________________________________ Wikitech-l mailing list Wikitech-l@wikimedia.org http://mail.wikipedia.org/mailman/listinfo/wikitech-l
wikitech-l@lists.wikimedia.org