Adding correct link paths in Magento

by admin on October 28, 2010

When developing a Magento theme it is better practice to use the specific Magento code for creating site wide links instead of using specific paths.

The code to create the correct link path withing the CMS section of the admin panel:

<a href="{{store direct_url="your-page"}}">Link text</a>

To create links in the .phtml template files use this code:

<a href="<?php echo $this->getUrl('your-page') ?>">Link text</a>

Using this code Magento will create the correct path in the link for you.

Leave a Comment

Previous post: