Forums | Mahara Community
New set of Menu Items
17 June 2013, 9:21 AM
I am trying to create a set of new menus from an administration link I have setup. I changed the main menu items by using new strings for the menu item names in /lang/en.utf8/admin.php and changed the menu items to be displayed in /lib/web.php.
My problem is that I have a drop-down menu of items on the admin page and once an item is selected it will open a page with new menus. I thougt of copying the admin menus to a new sub-directory under admin and then change what I want form there. The problem is that when I add some new menus in /lib/web.php and add new strings in language file, how do I call those menu arrays in web.php.
Which file or files in the admin directory calls the menu arrays in /lib/web.php and how do I do this for a new set of menus. (The page is only for an admin user). Is it called from the .tpl file?
I need help urgently for a project!! Any help is highly appreciated.
17 June 2013, 12:16 PM
Did you add your new menu items to the array in the admin_nav() function in lib/web.php?
The file that displays the navigation menus is the template header/navigation.tpl (its actual location depends on your theme; the default is theme/raw/templates/header/navigation.tpl). In there, the menu items are in the smarty variable $MAINNAV. This smarty variable is assigned in the function smarty() in lib/web.php, using the results from calling the function main_nav(), also in lib/web.php.
If your new menus aren't showing up in the page you click through to, perhaps you haven't marked it as an admin page? main_nav() calls the function in_admin_section() to determine if you're on an admin page (and thus should see the admin menu), and as you can see in that function, to tell it you're on an admin page you need to add define('ADMIN', 1); to the top of your page. Look at the top of admin/registersite.php, for example.
If this doesn't solve your problem, it would be helpful if you could attach a copy of your lib/web.php file and the file for the page that the menu doesn't show up on (or even better, a github link to them ;), so we can see specifically what you're doing.
Good luck with your urgent project!
18 June 2013, 8:40 AM
I did not add new menu items, what I did was tried to create a new set of menus that will be accessed from a link on the main admin page (but not from a menu item, just a link form a drop down box located beside the logo).
In trying to create the new set of menus I duplicated the admin menu and renamed it location. I then changed the index.php to point to location.tpl as I wanted to use it to call loacheader.tpl instead of header.tpl (this is because it calls navigation.tpl which has the main navigation menu and I wanted to call my new menu instead from locnavigation.tpl.
When I tried to access the wwwroot/location/index.php I now get a blank screen. IThis happens whenever I assign the smarty object for the new $LOCNAV in locnavigation.tpl (which replaces $MAINNAV in navigation.tpl).
I would like to send the files as you mentioned via github but dont know how to do this.
Thanks for your help so far.
Is there somewhere I could get some paid help as I have a deadline for the project and would need some more guidance with other aspects of it and not just the menu.
Also is there a better was to do the menus. I could email you a link of the wireframes and get some advice on each specification.
18 June 2013, 12:59 PM
The Mahara lead developers are my employer, Catalyst IT, and we are available for hire for Mahara support. I'll PM you with the contact info for one of our project managers.
There are also several "Mahara Partner" companies which provide Mahara support and hosting services. You can find their contact info here: https://mahara.org/partners
18 June 2013, 1:09 PM
Now to continue with the free advice , if you're getting a blank screen it probably means PHP is having a fatal error or a syntax error. Look at your PHP error log and you should see a message there. The location of your PHP error log will depend on your operating system and system configuration. If you're using Ubuntu, by default the PHP errors are piped into the Apache error log at /var/log/apache2/error.log
If you don't know about github, no worries. The easiest way to share a file with us is probably to upload it to a dropbox site, such as http://ge.tt/. (You can also share them by uploading them into your account on mahara.org and providing a link like this one, but if you're new to the Mahara platform, using ge.tt is probably easier.)
I am a bit confused about what you're trying to accomplish. Maybe you could achieve what you want by using the "Links & resources" admin option? http://manual.mahara.org/en/1.7/administration/config_site.html#menus