Forums | Mahara Community

Support /
Customizing Theme etc.


anonymous profile picture
Account deleted
Posts: 34

10 July 2009, 10:38

How did you get the nav menu up on the main site page so that you can view them without logging in?  This would be a great help.  Thanks.

 --
David Varney
Celeritas Interactive Media
Celeritasdesign.com 

anonymous profile picture
Account deleted
Posts: 34

10 July 2009, 16:27

I actually figured out how to add my initial menu (the index.php) that is shown to a logged out and/or new visitor.  The problem I'm having is that the menu items have a space in between each menu item (look at the menu here: ' linkademy.com/index.php ' ) .

How I did this:

Made a custom function called 'pub_nav' and placed it below the existing 'main_nav' function within the web.php page.
Code here:

function pub_nav() {

$menu = array(

                 array(

                   'path' => '',

                     'url' => '',

                     'title' => get_string('home'),

                     'weight' => 10,

                ),

                 array(

'path' => '',

                     'url' => 'about.php',

                     'title' => get_string('about'),

                     'weight' => 20,

                 ),

                 array(

                     'path' => '',

                     'url' => 'news.php',

                     'title' => get_string('news'),

                     'weight' => 30,

                 ),

                 array(

                     'path' => '',

                     'url' => 'colleges.php',

                     'title' => get_string('colleges'),

                     'weight' => 40,

                 ),

                 array(

                     'path' => '',

                     'url' => 'industry.php',

                     'title' => get_string('industry'),

                     'weight' => 50,

                 ),

                 array(

                     'path' => '',

                     'url' => 'contact.php',

                     'title' => get_string('contact'),

                     'weight' => 60,

                 ),

           );

    

    return $menu;

}

Then I the placed the following line into line 374 on the web.php file so that the 'pub_nav' function will be called when it senses the user isn't logged in. 
Code Here:
$smarty->assign('PUBNAV', pub_nav());

Next I modified the header.tpl file. In the code below, the bold parts are the code that I added.  You will see that I copied the $MAINNAV section and replaced the MAIN part with PUB. Then I placed both sections into a IF/ELSE statement for when somebody is carrying the $LOGGEDIN variable it will choose the $MAINNAV section of code and when they aren't it will default to the $PUBNAV section of code.
Code Here:

{if $LOGGEDIN}

    {if $MAINNAV}

            <div id="mainnav">

            <ul>

    {foreach from=$MAINNAV item=item}

    {if $item.selected}{assign var=MAINNAVSELECTED value=$item}<li class="selected"><a href="{$WWWROOT}{$item.url|escape}">{$item.title|escape}</a></li>{else}<li><a href="{$WWWROOT}{$item.url|escape}">{$item.title|escape}</a></li>{/if}{/foreach}{if $LOGGEDIN}{if $USER->get('admin') || $USER->is_institutional_admin()}{if $ADMIN || $INSTITUTIONALADMIN}<li><a href="{$WWWROOT}">{str tag="returntosite"}</a></li>{elseif $USER->get('admin')}<li><a href="{$WWWROOT}admin/">{str tag="siteadministration"}</a></li>{else}<li><a href="{$WWWROOT}admin/users/search.php">{str tag="useradministration"}</a></li>{/if}{* <li><a href="" onclick="createLoggingPane(); return false;">Create Logging Pane</a></li> *}{/if}<li><a href="{$WWWROOT}?logout">{str tag="logout"}</a></li>{/if}

            </ul>

            </div>

        </div>

        <div id="subnav">

    {if $MAINNAVSELECTED.submenu}

        <ul>

    {foreach from=$MAINNAVSELECTED.submenu item=item}<li{if $item.selected} class="selected"{/if}><a href="{$WWWROOT}{$item.url|escape}">{$item.title|escape}</a></li>{/foreach}

        </ul>

    {/if}

    {/if}

        </div>

{else}

{if $PUBNAV}

<div id="mainnav">

<ul>

    {foreach from=$PUBNAV item=item}

    {if $item.selected}{assign var=PUBNAVSELECTED value=$item}<li class="selected"><a href="{$WWWROOT}{$item.url|escape}">{$item.title|escape}</a></li>{else}<li><a href="{$WWWROOT}{$item.url|escape}">{$item.title|escape}</a></li>{/if}{/foreach}{if $LOGGEDIN}{if $USER->get('admin') || $USER->is_institutional_admin()}{if $ADMIN || $INSTITUTIONALADMIN}<li><a href="{$WWWROOT}">{str tag="returntosite"}</a></li>{elseif $USER->get('admin')}<li><a href="{$WWWROOT}admin/">{str tag="siteadministration"}</a></li>{else}<li><a href="{$WWWROOT}admin/users/search.php">{str tag="useradministration"}</a></li>{/if}{* <li><a href="" onclick="createLoggingPane(); return false;">Create Logging Pane</a></li> *}{/if}<li><a href="{$WWWROOT}?logout">{str tag="logout"}</a></li>{/if}

</ul>

</div>

</div>

<div id="subnav">

{if $PUBNAVSELECTED.submenu}

<ul>

{foreach from=$PUBNAVSELECTED.submenu item=item}<li{if $item.selected} class="selected"{/if}><a href="{$WWWROOT}{$item.url|escape}">{$item.title|escape}</a></li>{/foreach}

</ul>

{/if}

{/if}

</div>

{/if } 

 

 

If anybody has an insight that would fix this problem it would be greatly appreciated. 

--
David Varney
Celeritas Interactive Media
Celeritasdesign.com 

anonymous profile picture
Account deleted
Posts: 34

13 July 2009, 13:18

I figured out what my problem is/was.  I had to add the menu-bg.gif into my CSS.
13 results