I am printing the customers email address in the header like so:
<?php echo $email=$this->__('Hello, %s', Mage::getSingleton('customer/session')->getCustomer()->getEmail()); ?>
However I want to truncate this to a certain number due to users with long email addresses.
I have tried to use the truncate helper which magento has but I am getting no joy, wondering if anyone can help.
<?php echo $email=$this->__('Hello, %s', Mage::getSingleton('customer/session')->getCustomer()->getEmail()->truncate('text', 12)); ?>
Thanks
Ok if that ok then you are doing in wrong way.For truncate using Magento you should try like this :
<?php echo Mage::helper('core/string')->truncate('abacdkdslsdfkjdfss@yahoo.com', 12); ?>
AS for you email concerned you can try like this : User proper email getter function .you can assign that to any variable instead of echo
<?php echo Mage::helper('core/string')->truncate(Mage::getSingleton('customer/session')->getCustomer()->getEmail(), 12); ?>
OUTPUT : abacdkdslsdf
First parameter will be your string and second will be length of that text.Hope this will help you