Getting the Magento Base Paths and URL’s

Just a little reference:

 Mage::getBaseDir(‘app’) => Get app directory path
 Mage::getBaseDir(‘media’) => Get media directory path
 Mage::getBaseDir(‘design’) => Get design directory path
 Mage::getBaseDir(‘code’) => Gives code directory file path
 Mage::getBaseDir(‘lib’) => Gives lib directory file path
 Mage::getBaseDir(‘skin’) => Gives skin directory file path
 Mage::getBaseDir(‘var’) => Gives var directory file path
 Mage::getBaseDir(‘cache’) => Gives cache directory file path
 Mage::getBaseDir(‘log’) => Gives log directory file path

Urls:

 Mage::getBaseUrl() => Get base url path e.g. http://yourwebsite.com/
 Mage::getBaseUrl('media') => Get MEDIA folder path e.g. http://yourwebsite.com/media/
 Mage::getBaseUrl('js') => Get JS folder path e.g. http://yourwebsite.com/js/
 Mage::getBaseUrl('skin') => Get SKIN folder path e.g. http://yourwebsite.com/skin/
 
 Mage::getUrl('',array('_secure'=>true))
 Mage::getUrl('module/controller/action',array('_secure'=>true))
 Mage::getUrl('module/controller/action')

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

Static Blocks

{{base url=''}}
{{skin url='images/skinimage.jpg'}}
{{media url='/mediaimage.jpg'}}
{{store url=''}}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s