I'm trying to get the base url and the media directory from the Magento configuration and I'm trying to use them for a template that has images. I've only gotten as far Mage::getConfig()
. I'm not sure what to do next...
views:
20answers:
1
+1
A:
Mage::getBaseDir ($type='base')
http://freegento.com/doc/d8/dcb/class_mage.html#7c9023c03db151ba782ec95ab289f2fe
Or also
<?php echo Mage::getURL('customerfolder/subfolder')."images/payment_types.gif" ?>
This will return would return http://www.yourdomain.com/customerfolder/subfolder
infinity
2010-10-28 21:50:18
Concatenating paths after the function can be problematic, in some cases `getUrl` may append query strings like a SID value which would then get in the way of the rest of your path. Instead you should use `Mage::getUrl('', array('_direct'=>'customerfolder/subfolder/images/payment_types.gif', '_type'=>'direct_link'))`. See http://www.magentocommerce.com/wiki/5_-_modules_and_development/reference/geturl_function_parameters
clockworkgeek
2010-10-28 22:44:06