Programmatically Create Menu Item in Joomla

后端 未结 4 1830
慢半拍i
慢半拍i 2021-01-13 22:23

I have created a component in joomla 2.5 that creates a new article and adds that article to a menu item.

Creating the article is working fine, but I am having some

4条回答
  •  醉酒成梦
    2021-01-13 22:33

    Try using JTableNested::setLocation($referenceId, $position = 'after'):

    $table->setLocation($parent_id, 'last-child');
    

    I also think that you need to rebuild the path:

    // Rebuild the tree path.
    if (!$table->rebuildPath($table->id)) {
        $this->setError($table->getError());
        return false;
    }
    

    If it still doesn't work, try to find out what MenusModelItem::save does that you don't.

提交回复
热议问题