Add top links in magento

Magento is an ecommerce platform built on open source technology and which use MVC system. It is managing all request response using Model, View and Controller. So, all view file call base on controller mapping as per there configuration in layout/*.xml file.

Layout file is use to define phtml file on specific module request. Let’s say if we want to add top link in magento at that time we need to use below code.

Add custom link to top link in magento


<block type="page/template_links" name="top.links" as="topLinks">
<action method="addLink" translate="label title">
<label>Blog</label>
<url>/blog</url>
<title>Blog</title>
<prepare></prepare>
<urlparams></urlparams>
<position>1</position>
</action>
</block>

If you want to open same URL in new tab at that time you can use below code.


<block type="page/template_links" name="top.links" as="topLinks">
<action method="addLink" translate="label title">
<label>Blog</label>
<url>/blog</url>
<title>Blog</title>
<prepare></prepare>
<urlparams></urlparams>
<position>1</position>
<liparams></liparams>
<aparams><!--[CDATA[target="_blank"]]--></aparams>
</action>
</block>

Tags: Magento1,

No comments

Leave a Reply

Your email address will not be published. Required fields are marked *