How to get current URL on phtml files

Simple tip where you will get the code to “extract” current Magento url from a template file.

Here is the code.

You can use it on any phtml file.

$this->helper('core/url')->getCurrentUrl() 


Behind the scenes, this calls a helper method and retrieves the current url.

You can also use this on any file by changing it to this code:

Mage::helper('core/url')->getCurrentUrl() 


Posted by .(JavaScript must be enabled to view this email address) on 02/14 at 02:43 PM

Name:

Email:

Location:

URL:

Smileys

Remember my personal information

Notify me of follow-up comments?

Submit the word you see below:


<< Back to main