TIP: Creating admin menu?s with fabrik 3.x

remico

Member
There is no TIPS and Tricks section for Fabrik 3.x but I think I should share this one with the other Fabrik fans.

On manny projects my customers are complaing about seachring for the right Fabrik list to edit (data) in the back-end. So I needed a Admin menu pointing to the right fabrik listst in the back-end of J!. After searching I discovered that there are no simple solutions to do this in J2.5. with existing modules.

The solution is really easy to do by your self without touching Joomla core files, only template overrides.

Follow the standard approach for overriding a view. In this case, copy the two files mentioned from the directory /administrator/modules/mod_menu/tmpl and place the copies into the admin template?s html directory. Assuming we are using the Bluestork template, the two files go here:

/administrator/bluestork/html/mod_menu/default_enabled.php
/administrator/bluestork/html/mod_menu/default_disabled.php

To create a new menu before the "Content" menu open default_enabled.php and search for:
PHP:
//
// Content Submenu
//

and place the folowing code above it:

PHP:
//Create Extra Menu
$menu->addChild(
	new JMenuNode(JText::_('Extra Menu'), '#'), true
);
$db =&JFactory::getDBO();
$sql="select * from dvf_menu";
$db->setQuery($sql);
$items = $db->loadAssocList();
foreach($items as $item){
	$menu->addChild(new JMenuNode($item["titel"], $item["link"], 'class:article'));
}
$menu->getParent();

Save the file!

Now create a list in Fabrik with table dvf_menu as data source and add two field elements to it (in this case called titel and link)

Off course you are free to use any table and field name as source, just modify the sql statement in the php page to match.

When you add records to the list you will see them as menu items in the new menu!

Good luck, hope this helps, I was planning to put it in th wiki, but I have no permissions to do so.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top