Magento Static, CMS, BASE, SKIN, JS, MEDIA , Current and any kind of URL

Get Base Url

<?php echo Mage::getBaseUrl(); //output=> http://yourwebsitename.com/ ?>

Get Media Base Url

 <?php echo Mage::getBaseUrl(‘media’);  //output=> http://yourwebsitename.com/media/  ?>

Get Js Base Url

  <?php echo Mage::getBaseUrl(‘js’);  //output=> http://yourwebsitename.com/js/ ?>

Get Skin Base Url

  <?php echo Mage::getBaseUrl(‘skin’);  //output=> http://yourwebsitename.com/skin/ ?>

For CMS and Static block url use 

Get Skin Url

  <?php {{skin url=’images/imagename.jpg’}}  ?>

Get Media Url

  <?php {{media url=’/sampleimage.jpg’}}  ?>

Get Store Url

  <?php {{store url=’.html’}}  ?>

Get Current Url

 <?php echo  Mage::helper(‘core/url’)->getCurrentUrl(); ?>

Get Magento Directory

<?php echo Mage::getBaseDir(); //output : /var/www/html/magento  ?>

<?php echo Mage::getBaseDir(‘app’); //output : /var/www/html/magento/app  ?>

<?php echo Mage::getBaseDir(‘media’);  //output : /var/www/html/magento/media  ?>

Same way you can find  code, lib, etc  directory path ….

Leave a Reply