1

I need to add top links via extension.i accomplish it.but it create wrong url.

<default>
    <reference name="root">
        <reference name="top.links">
            <action method="addLink" translate="label title">
                <label>Events</label>
                <url>/myextension/index/eventcalender</url>
                <title>Events</title>
                <prepare/>
                <urlParams/>
                <position>10</position>
            </action>
        </reference>
    <default>

its adding new top links as events. but problam is it not create correct url

its create http://127.0.0.1:8080/myextension/index/eventcalender

instead of http://127.0.0.1:8080/myextension/index.php/index/eventcalender yes I know i can simply solve that changing

<url>/myextension/index/eventcalender</url>   to

 <url>index.php/myextension/index/eventcalender</url>

but when i go to http://127.0.0.1:8080/myextension/index.php/index/eventcalender

it works correct but i click top link by staging

http://127.0.0.1:8080/myextension/index.php/index/eventcalender

index.php/index/eventcalender part append again to link

http://127.0.0.1:8080/myextension/index.php/index/eventcalender/index.php/index/eventcalender/

and give 404 error so i need to know correct way to give link within xml file above

1

add these two line like that then your url will work.

 <prepare>true</prepare>
 <urlParams helper="core/url/getHomeUrl" />

complete code

<default>
   <reference name="root">
    <reference name="top.links">
        <action method="addLink" translate="label title">
            <label>Events</label>
            <url>myextension/index/eventcalender</url>
            <title>Events</title>
            <prepare>true</prepare>
            <urlParams helper="core/url/getHomeUrl" />
            <position>10</position>
        </action>
    </reference>
<default>
2
  • yes ,but it's only give home url,can you give some tip how to add it with my code. – srinath madusanka Apr 21 '16 at 5:32
  • added the complete code hope will helpful for you – Qaisar Satti Apr 21 '16 at 5:35

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.