Magento News
Use Magento’s getUrl inside a function
public function getWelcome()
{
if (empty($this->_data['welcome'])) {
if (Mage::isInstalled() && Mage::getSingleton('customer/session')->isLoggedIn()) {
$this->_data['welcome'] = $this->__('Welcome, %s!', $this->escapeHtml(Mage::getSingleton('customer/session')->getCustomer()->getName()));
} else {
$this->_data['welcome'] = $this->__('Welcome, <a href="">Sign in</a> or <a href="">Register</a>');
}
}
return $this->_data['welcome'];
}
I want to know if I can use the function Mage::getUrl(‘/whatever’) inside this function.
More specifically, I need to use a link inside the
else {
$this->_data['welcome'] = $this->__('Welcome, <a href="">Sign in</a> or <a href="">Register</a>');
}
Thanks.
EDIT
The solution:
$this->__('Welcome, <a href="%1$s">Sign in</a> or <a href="%2$s">Register</a>',
Mage::getUrl('customer/account/login'),
Mage::getUrl('customer/account/create')
);
Use Magento’s getUrl inside a function
Possibly Related Posts:
- Database query different results
- Menu highlight in magento under admin
- magento disable a banner on certain category pages or have a banner with multiple links
- Magento, using ACL for frontend. Possible?
- Magento IE-7 Fix In Windows XP
RSS Feed