1

I created extension.i need to create top link to access my custom extension page. i don't want to change it via local.xml or changing core phtml file.

is there way to add remove top links via custom extension. I try to using adding below to my layout.xml within default tag

<reference name="top.links">
<action method="addLink" translate="label title"><label>New</label><url>new
</url><title>New</title><prepare/><urlParams/><position>60</position></action>
</reference>

but it not working.

Here is my layout.xml file

<?xml version="1.0"?>
<layout version="0.1.0">
    <default>
    <reference name="top.links">
    <action method="addLink" translate="label title"><label>Events</label>monthly/index<url>
    </url><title>Events</title><prepare/><urlParams/><position>60</position></action>
    </reference>
    </default>
    <monthly_index_index>
        <reference name="content">
            <block type="monthly/monthly" name="monthly" template="monthly/monthly.phtml" />
        </reference>
    </monthly_index_index>
    <monthly_index_eventcalender>
        <reference name="content">
            <block type="monthly/monthly" name="monthly" template="monthly/events.phtml" />
        </reference>
  <reference name="head">

         <action method="addItem"><type>skin_js</type><name>js/monthly.js</name></action>
        <action method="addCss"><stylesheet>css/monthly.css</stylesheet></action>
    </reference>
    </monthly_index_eventcalender>

</layout>

and here is my config file

<config>
    <modules>
        <Lkwebtools_Monthly>
            <version>0.1.0</version>
        </Lkwebtools_Monthly>
    </modules>
    <frontend>
        <routers>
            <monthly>
                <use>standard</use>
                <args>
                    <module>Lkwebtools_Monthly</module>
                    <frontName>monthly</frontName>
                </args>
            </monthly>
        </routers>
        <layout>
            <updates>
                <monthly>
                    <file>monthly.xml</file>
                </monthly>
            </updates>
        </layout>
    </frontend>
    <admin>
        <routers>
            <monthly>
                <use>admin</use>
                <args>
                    <module>Lkwebtools_Monthly</module>
                    <frontName>monthly</frontName>
                </args>
            </monthly>
        </routers>
    </admin>
    <adminhtml>
        <menu>
            <monthly module="monthly">
                <title>Monthly Event Calender</title>
                <sort_order>71</sort_order>               
                <children>
                    <items module="monthly">
                        <title>Manage Events</title>
                        <sort_order>0</sort_order>
                        <action>monthly/adminhtml_monthly</action>
                    </items>
                </children>
            </monthly>
        </menu>
        <acl>
            <resources>
                <all>
                    <title>Allow Everything</title>
                </all>
                <admin>
                    <children>
                        <Lkwebtools_Monthly>
                            <title>Monthly Module</title>
                            <sort_order>10</sort_order>
                        </Lkwebtools_Monthly>
                    </children>
                </admin>
            </resources>
        </acl>
        <layout>
            <updates>
                <monthly>
                    <file>monthly.xml</file>
                </monthly>
            </updates>
        </layout>
    </adminhtml>   
    <global>
        <models>
            <monthly>
                <class>Lkwebtools_Monthly_Model</class>
                <resourceModel>monthly_mysql4</resourceModel>
            </monthly>
            <monthly_mysql4>
                <class>Lkwebtools_Monthly_Model_Mysql4</class>
                <entities>
                    <monthly>
                        <table>monthly</table>
                    </monthly>
                </entities>
            </monthly_mysql4>
        </models>
        <resources>
            <monthly_setup>
                <setup>
                    <module>Lkwebtools_Monthly</module>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </monthly_setup>
            <monthly_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </monthly_write>
            <monthly_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </monthly_read>
        </resources>
        <blocks>
            <monthly>
                <class>Lkwebtools_Monthly_Block</class>
            </monthly>
        </blocks>
        <helpers>
            <monthly>
                <class>Lkwebtools_Monthly_Helper</class>
            </monthly>
        </helpers>
    </global>
</config>
  • This information is not. show your config.xml file and specify path to those files – Rajeev K Tomy Apr 20 '16 at 4:55
  • this is XML not HTML why you are use <br> ? – Minesh Patel Apr 20 '16 at 4:57
  • 1
    this is because of <br> tag your xml is not loaded by magento – Minesh Patel Apr 20 '16 at 4:58
  • 1
    Remove <br> tag and add this into your custom extension xml file – Magento 2 Apr 20 '16 at 5:06
  • sorry. there hasn't br tags.it is my mistake when i typing .is i need to add header.phtml file in my extension to work this? please see edited quiz – srinath madusanka Apr 20 '16 at 5:11
0

Here the problem is, your layout update XML file has wrong name. It should be monthly.xml instead of layout.xml and it should be reside at app\design\frontend\base\default\layout\monthly.xml.

After make all these changes, please clear your cache.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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