How can I use a variable in the follow href element:
Example, instead of https://mag.outdoorequipped.com/ I like to use a variable. But I do not know how to get it in Magento.
Kindly Simon
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityHow can I use a variable in the follow href element:
Example, instead of https://mag.outdoorequipped.com/ I like to use a variable. But I do not know how to get it in Magento.
Kindly Simon
Magento has handy helpers so that you don't need to hard code the links. You can use the following to go to mag.outdoorequipped.com/active in a phtml file:
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . '/active'
or in a cms block:
{{store url="/active"}}
In phtml files
Mage::getBaseUrl();
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
Mage::helper('core/url')->getCurrentUrl();
In cms pages or static blocks
{{store url=""}}
{{skin url='images/imagename.jpg'}}
{{media url='/imagename.jpg'}}
{{store url='mypage.html'}}
{{store url="/active"}}
which should give you the correct url
I did as followed and it works for me nice:
<div class="row">
<div class="col-sm-2"><a href="{{store direct_url="brands/clarks.html"}}"><img alt="" src="{{media url="wysiwyg/menulogo/fashion/clarks.jpg"}}" /></a></div>
<div class="col-sm-2"><a href="{{store direct_url="brands/dr-martens.html"}}"><img alt="" src="{{media url="wysiwyg/menulogo/fashion/drmartens.jpg"}}" /></a></div>
<div class="col-sm-2"><a href="{{store direct_url="brands/kenneth-cole.html"}}"><img alt="" src="{{media url="wysiwyg/menulogo/fashion/kennethcole.jpg"}}" /></a></div>
<div class="col-sm-2"><a href="{{store direct_url="brands/royal-robbins.html"}}"><img alt="" src="{{media url="wysiwyg/menulogo/fashion/royalrobbins.jpg"}}" /></a></div>
<div class="col-sm-2"><a href="{{store direct_url="brands/sebago.html"}}"><img alt="" src="{{media url="wysiwyg/menulogo/fashion/sebago.jpg"}}" /></a></div>
<div class="col-sm-2"><a href="{{store direct_url="brands/gh-bass.html"}}"><img alt="" src="{{media url="wysiwyg/menulogo/fashion/ghbass.jpg"}}" /></a></div>