You are not logged in.

#1 2014-09-09 22:29:10

Delectable
Member
Registered: 2014-09-09
Posts: 4

ArchLinux Wiki navbar

I cloned the ArchLinux wiki following this topic: https://bbs.archlinux.org/viewtopic.php?id=76683. I adjusted it to the 1.23.3 versions and after completing the additional templates everything is well. The last thing I want to do is have my own links in the navbar, within ArchLinux they are Home, Packages, Forums, Wiki, Bugs, AUR and Download.

The lines for the navbar reside in ArchLinux.php. The code specific to the navbar looks like this:

<div id="archnavbar"><!-- Arch Linux global navigation bar -->
        <div id="archnavbarlogo">
                <p><a id="logo" href="<?php if (isset($wgArchHome)) { echo $wgArchHome; } ?>"></a></p>
        </div>
        <div id="archnavbarmenu">
                <ul id="archnavbarlist">
                        <?php
                        if (isset($wgArchNavBar)) {
                                foreach ($wgArchNavBar as $name => $url) {
                                        if ((isset($wgArchNavBarSelected) && $this->data['title'] == $name && in_array($name, $wgArchNavBarSelected))
                                                || (!(isset($wgArchNavBarSelected) && in_array($this->data['title'], $wgArchNavBarSelected)) && isset($wgArchNavBarSelectedDefault) && $name == $wgArchNavBarSelectedDefau$
                                                $anbClass = ' class="anb-selected"';
                                        } else {
                                                $anbClass = '';
                                        }
                                        echo '<li id="anb-'.strtolower($name).'"'.$anbClass.'><a href="'.$url.'">'.$name.'</a></li>';
                                }
                        }
                        ?>
                </ul>
        </div>
</div><!-- #archnavbar -->

It looks like the script is looking for $wgArchNavBar. Where and how do I define this variable?

Last edited by Delectable (2014-09-09 22:54:18)

Offline

#2 2014-09-09 22:46:49

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: ArchLinux Wiki navbar

I think it uses MediaWiki, right?  If so, that'd be defined in LocalSettings.php


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2014-09-09 22:51:13

Delectable
Member
Registered: 2014-09-09
Posts: 4

Re: ArchLinux Wiki navbar

Trilby wrote:

I think it uses MediaWiki, right?  If so, that'd be defined in LocalSettings.php

Yes both are true. But when I add

 $wgArchNavBar = "http://www.google.com"

to LocalSettings.php it generates a white pages indicating a PHP error. I also wonder how $wgArchNavBarSelected is used in this context, and whether it should be defined in LocalSettings.php as well?

Last edited by Delectable (2014-09-09 22:53:10)

Offline

#4 2014-09-09 22:53:47

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: ArchLinux Wiki navbar

Why would you add that?  What was originally there?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2014-09-09 22:56:35

Delectable
Member
Registered: 2014-09-09
Posts: 4

Re: ArchLinux Wiki navbar

When git cloning the ArchWiki Mediawiki instance there was no LocalSettings.php provided. This makes sense as a new install requires a new generated LocalSettings.php, meaning that the links are not defined resulting in an empty navbar.

Offline

#6 2014-09-09 23:04:40

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: ArchLinux Wiki navbar

Ah, true.  But still, why the single url?  The code you included in your first post indicates that it needs to be an associative array of names and urls.  You just set it to a string value of a single url.  That can't work.

I'm pretty much crap with php, but wouldn't that need to be something like:

$wgArchNavBar = array(
   "google" => "http://google.com",
);

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#7 2014-09-09 23:12:05

Delectable
Member
Registered: 2014-09-09
Posts: 4

Re: ArchLinux Wiki navbar

You sir are awesome!!

The array is functioning and the links are showing up as you predicted.

Offline

Board footer

Powered by FluxBB