Pages

Thursday, September 10, 2015

Magento2: Truncate the string.

We have to use the below syntax if we need to truncate the string from .phtml file

<?php $length = 10; ?>
<?php $string = new \Magento\Framework\Stdlib\String;?>
<?php echo $string->substr($data->getContent(),0,$length); ?>

No comments:

Post a Comment