Elgg topbar customisation - tools drop down

Hi there

Total newbie here so please be gentle :O) I am customising the topbar, getting on well with it but just one thing I can't seem to figure out.

I want to keep the 'Tools' drop down and have it auto update with plugins ad only show to logged in members as it currently does but I don't want it to be a drop down menu. I want to change it to a horizontal nav.

I am great at CSS but my php is terrible so I would really appreciate any help here!

I am guessing this is the code I need to change fromnavigation/topbar_tools.php...

$menu = get_register('menu');

//var_export($menu);

if (is_array($menu) && sizeof($menu) > 0) {
    $alphamenu = array();
    foreach($menu as $item) {
        $alphamenu[$item->name] = $item;
    }
    ksort($alphamenu);

?>

<ul class="topbardropdownmenu">
    <li class="drop"><a href="#" class="menuitemtools"><?php echo(elgg_echo('tools')); ?></a>
    <ul>
    <?php
        foreach($alphamenu as $item) {
            echo "<li><a href=\"{$item->value}\">" . $item->name . "</a></li>";
        }
    ?>
    </ul>
    </li>
</ul>

<script type="text/javascript">
$(function() {
    $('ul.topbardropdownmenu').elgg_topbardropdownmenu();
});
</script>

<?php
}

Can anyone help me please?

Thanks in advance

  • 1. remove the javascript in the that view

    2. You can do the rest through CSS. Change the css on ul.topbardropdownmenu ul so that it is not hidden. Float the li elements. Probably need to adjust the width of the ul.

  • Thanks Cash, that worked great!!

    Took me a while to figure out which bits to remove, in the end I went with this...

     

    $menu = get_register('menu');

    //var_export($menu);

    if (is_array($menu) && sizeof($menu) > 0) {
        $alphamenu = array();
        foreach($menu as $item) {
            $alphamenu[$item->name] = $item;
        }
        ksort($alphamenu);

    ?>

    <ul class="topbardropdownmenu">
        <?php
            foreach($alphamenu as $item) {
                echo "<li><a href=\"{$item->value}\">" . $item->name . "</a></li>";
            }
        ?>

    </ul>

    <?php
    }

     

    Not sure if that is totally right but it worked!! Next I want to add a drop down menu beside the avatar icon with the users name and a drop down of user specific links such as 'settings, edit profile, friends, change profile image' etc any advice would be gratefully received?

    Thanks again