branko ajzele, senior developer / project manager

Posts / Articles

Magento, retrieving base url path

Retrieving base url path of a Magento instllation is a trivial task. Trivial if you know where to look. If you open /app/Mage.php file and look at line 204, you will se a function getBaseUrl. Function recieves two parametars, but those are not conditional. Do do a test run, open youre app/design/frontend/default/default/template/catalog/product/view.phtml file and place the following inside

<?php echo Mage::getBaseUrl();  ?>

This will echo out the base url path. Could be useful if you’re like me doing WordPress to Magento and vice versa connections and so on.

  • Lloyd

    any luck with Magento and WordPress. That sounds like an awesome combination!

  • Lloyd

    any luck with Magento and WordPress. That sounds like an awesome combination!

  • mautrix

    pretty usefull thanks !

  • http://www.thebolivianshop/magento mautrix

    pretty usefull thanks !

  • monisha

    Thnks … its works.. can u help me in my another issue….
    I want to show something only on front – index page. Is there any flag or some condition tht I put on my code ??

  • monisha

    Thnks … its works.. can u help me in my another issue….
    I want to show something only on front – index page. Is there any flag or some condition tht I put on my code ??

  • http://www.auxsoftph.com/ Daniel

    can I ask how to get the base url inside CMS, is there a equivalent {{skin url}} for the base url?

    I try {{base_url}} or {{base url}} but it does not work.

    Hope you can help..

  • http://www.auxsoftph.com Daniel

    can I ask how to get the base url inside CMS, is there a equivalent {{skin url}} for the base url?

    I try {{base_url}} or {{base url}} but it does not work.

    Hope you can help..

  • RoBeck

    As always….very useful

  • RoBeck

    As always….very useful

  • http://www.balkotarde.com/ Balkotrade

    use {{store url=”"}} for base url

  • http://www.balkotarde.com Balkotrade

    use {{store url=”"}} for base url

  • circlecube

    Thanks! Just what I was looking for.

  • nkos

    Thank you !!

blog comments powered by Disqus