Forums | Mahara Community
Open Discussion
/
Navigation Bar on the left
04 December 2009, 1:07
I'll like to have a pulldown version of the top menu on the left sidebar. I believe I need to start looking into lib/web.lib to make any changes. what will be the best way....i'll like for it to look like what's on mahara when you log in.04 December 2009, 5:02
Hi Rene,
it´s a good start to use a tool like firebug to investigate the theme layout.
HTH Heinz
07 December 2009, 0:11
Hi,
I've added the basic collapse/expand navigation to my website.
Below were the steps I took.
a. added the function to js/mahara.js
//navigation
menu_status = new Array();
function showHide(theid){
if (document.getElementById) {
var switch_id = document.getElementById(theid);
if(menu_status[theid] != 'show') {
switch_id.className = 'show';
menu_status[theid] = 'show';
}else{
switch_id.className = 'hidden';
menu_status[theid] = 'hidden';
}
}
}
b. added to theme/default/static/style/style.css
/* navigation sideblock */
.show {
display: block;
}
c. created and added to theme/default/templates/sideblocks/navigation.tpl
<h3>{str tag="navigation" }</h3>
<ul id="navigation" class="cr">
{foreach from=$data item=item}
{if $item.path == ''}
<li><a href="{$WWWROOT}{$item.url}">{$item.title}</a></li>
{/if}
{if $item.path == 'groups'}
<li><a onclick="showHide('mymenu1')">{$item.title}</a>
<div id="mymenu1" class="hidden">
<ul>
<li><a href="{$WWWROOT}group/mygroups.php">My Groups</a></li>
<li><a href="{$WWWROOT}group/find.php">Find Groups</a></li>
<li><a href="{$WWWROOT}user/myfriends.php">My Friends</a></li>
<li><a href="{$WWWROOT}user/find.php">Find Friends</a></li>
</ul>
<div>
</li>
{/if}
{if $item.path == 'profile'}
<li><a onclick="showHide('mymenu2')">{$item.title}</a>
<div id="mymenu2" class="hidden">
<ul>
<li><a href="{$WWWROOT}view/blocks.php?profile=1">Edit profile page</a></li>
<li><a href="{$WWWROOT}user/view.php">View profile page</a></li>
<li><a href="{$WWWROOT}artefact/internal">Edit Profile</a></li>
<li><a href="{$WWWROOT}artefact/file/profileicons.php">Profile Icons</a></li>
<li><a href="{$WWWROOT}artefact/resume">My Resume</a></li>
</ul>
</div>
</li>
{/if}
{if $item.path == 'myportfolio'}
<li><a onclick="showHide('mymenu3')">{$item.title}</a>
<div id="mymenu3" class="hidden">
<ul>
<li><a href="{$WWWROOT}view">My Views</a></li>
<li><a href="{$WWWROOT}artefact/file">My Files</a></li>
<li><a href="{$WWWROOT}artefact/blog">My Blogs</a></li>
</ul>
</div>
</li>
{/if}
{if $item.path == 'settings'}
<li><a onclick="showHide('mymenu4')">{$item.title}</a>
<div id="mymenu4" class="hidden">
<ul>
<li><a href="{$WWWROOT}account">Preferences</a></li>
<li><a href="{$WWWROOT}account/activity">Notifications</a></li>
</ul>
</div>
</li>
{/if}
{/foreach}
</ul>
d. add to lib/web.php
if($USER->is_logged_in()) {
$SIDEBLOCKS[] = array(
'name' => 'profile',
'id' => 'sb_profile',
'weight' => -20,
'data' => profile_sideblock()
);
/**
if (get_config('showonlineuserssideblock')) {
$SIDEBLOCKS[] = array(
'name' => 'onlineusers',
'id' => 'sb_onlineusers',
'weight' => -10,
'data' => onlineusers_sideblock(),
);
}
**/
if (get_config('shownavigationsideblock')) {
$SIDEBLOCKS[] = array(
'name' => 'navigation',
'id' => 'sb_navigation',
'weight' => -10,
'data' => main_nav(),
);
}
}
e. added to lib/config_defaults.php
// New: Whether to show the left-side nagivation bar
$cfg->shownavigationsideblock = true;
10 November 2010, 0:02
What is the exact position of content to add on to web.lib
10 November 2010, 0:07
What is the exact position of content to add on to web.lib