How to trigger a reconnect menu from a custom front-end component in Joomla?

I use Joomla 2.5 to create a special component that runs from the front-end.

This component parses the xml file to create a Joomla menu, I execute the INSERT INTO #__ request , but leave 0s for lft and rgt strong>.

The menu is created very randomly, and when I click the Rebuild button on the rear panel, everything looks fine after that, the path , lft strong> and rgt .

I spent 2 days doing the rebuild task from my external controller and component module, I even tried using jimport ('joomla.database.tablenested'). but the lack of knowledge of PHP OOP does not allow me to execute the rebuild function correctly ...

The last thing I wrote is the following:

jimport('joomla.database.tablenested');
class BSImportModelBSImport extends JModel
{
  ...
  function theimport()
  {
    ...
    $db =& JFactory::getDBO();
    $menu = new JTableNested('Menu', 'id',&$db);
    return $menu->rebuild();
  }
}

Please do not throw stones at my head if my question looks silly ... I really need help ...

+5
source share
1 answer

I use the save table menu method:

$data = array ( 
    'id' => 0 ,
    'title' => '{menu name}' ,
    'note' => '',
    'link' => '{link}',
    'menutype' => '{menutype}' ,
    'type' => 'url', 
    'published' => 1 ,
    'parent_id' => 1 ,
    'level' => 1 ,
    'component_id' => 0 ,
    'browserNav' => 0 ,
    'access' => getLevel() ,
    'template_style_id' => 0 ,
    'language' => '*' ,
    'params' => array ( 
        'menu-anchor_title' => '' ,
        'menu-anchor_css' => '' ,
        'menu_image' => '{url of logo for menu}',
        'menu_text' => 1 ) ,
);
$menuTable = JTable::getInstance('Menu', 'JTable', array());
$menuTable->save($data);

This method creates a new menu and is automatically restored.

0
source

All Articles