0

Am creating some admin manu and I have this error in logs Warning: simplexml_load_string(): Entity: line 32: parser error : Start tag expected, '<' not found in /var/www/vhosts/domaine.com/lib/Varien/Simplexml/Config.php on line 510 and the menu entry doesn't appear either.

config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Sd_Menuadmin>
            <version>0.1.0</version>
        </Sd_Menuadmin>
    </modules>

    <global>
        <helpers>
            <sd_menuadmin>
                <class>Sd_Menuadmin_Helper</class>
            </sd_menuadmin>
        </helpers>
    </global>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <sd_menuadmin before="Mage_Adminhtml">Sd_Menuadmin_Adminhtml</sd_menuadmin>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
    <adminhtml>
        <layout>
            <updates>
                <sd_menu>
                    <file>sd_menu.xml</file>
                </sd_menu>
            </updates>
        </layout>
    </adminhtml>
</config>

adminhtml.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <adminhtml>  // <- To fix the bug, do not put this tag
        <menu>
            <menu1 translate="title" module="sd_menuadmin">
                <title>Menu 1</title>
                <sort_order>100</sort_order>
                <children>
                    <menuitem1 module="sd_menuadmin">
                        <title>Submenu 1</title>
                        <action>adminhtml/menu</action>
                    </menuitem1>
                    <menuitem2 module="sd_menuadmin">
                        <title>Submenu 2</title>
                        <action>adminhtml/menu/list</action>
                    </menuitem2>
                </children>
            </menu1>
        </menu>
        <acl>
            <resources>
                <admin>
                    <children>
                        <menu1 translate="title" module="sd_menuadmin">
                            <title>Menu 1</title>
                            <sort_order>101</sort_order>
                            <children>
                                <menuitem1 module="sd_menuadmin">
                                    <title>Submenu 1</title>
                                </menuitem1>
                            </children>
                            <menuitem2 module="sd_menuadmin">
                                <title>Submenu 2</title>
                            </menuitem2>
                        </menu1>
                    </children>
                </admin>
            </resources>
        </acl>
    </adminhtml>
</config>

Sd_Menuadmin.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Sd_Menuadmin>
            <active>true</active>
            <codePool>local</codePool>
        </Sd_Menuadmin>
    </modules>
</config>

MenuController.php in app/code/local/Sd/Menu/controllers/Adminhtml/MenuController.php  

<?php

class Sd_Menuadmin_Adminhtml_MenuController extends Mage_Adminhtml_Controller_Action{

    public function indexAction()
    {
        $this->loadLayout()
            ->_setActiveMenu('mycustomtab')
            ->_title($this->__('Submenu1')); // for title

        // my stuff

        $this->renderLayout();
    }

    public function listAction()
    {
        $this->loadLayout()
            ->_setActiveMenu('mycustomtab')
            ->_title($this->__('Submenu2')); //for title

        // my stuff

        $this->renderLayout();
    }
}
2
  • These two XML files look good, did you modify any other layout file? Maybe the module activation file in the app/etc/modules folder?
    – user12795
    Commented Apr 26, 2017 at 16:16
  • i cant find the issue, look my update.
    – PЯINCƎ
    Commented Apr 26, 2017 at 16:19

1 Answer 1

1

You have a typo on your Sd_menuadmin.xml on: </Sd_Menu>. It should be </Sd_Menuadmin> instead.

Also, you will have to modify your adminhtml.xml file. Remove the node <adminhtml> and make the <menu> node a child of the <config> node. Refresh your cache. That should work.

3
  • I was wrong when I copied the code, i have well </Sd_Menuadmin> and it's note this issue, thank you
    – PЯINCƎ
    Commented Apr 26, 2017 at 16:31
  • Okay, if you're still seeing the simplexml_load_string error, you might have modified another XML file by accident. If you're not seeing the error but your new menu isn't showing, you have to modify your adminhtml.xml file. Remove the node <adminhtml> and make the <menu> node a child of the config node. Refresh your cache. That might work.
    – user12795
    Commented Apr 26, 2017 at 16:57
  • yes the issue of menu which didn't appear is wel the <adminhtml>, please update your answer to accept it ;)
    – PЯINCƎ
    Commented Apr 26, 2017 at 19:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.