<div class="product-title">
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>">
<?php //echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>
<?php $name = $_product->getName(); ?>
<?php $limit = 3; ?>
<?php $words = explode(" ",$name); ?>
<?php $countword = count($words); ?>
<?php $wordname = implode(" ",array_splice($words,0,$limit)); ?>
<?php if($countword > $limit) : ?>
<?php echo $wordname .= "....."; ?>
<?php else : ?>
<?php echo $wordname; ?>
<?php endif; ?>
</a>
</div>
Jquery Example for character limit
<script>
jQuery('.product-title a').each(function(){
var data = jQuery(this).text(jQuery(this).text().trim().substr(0, 20)+'...');
});
</script>
Code For Making ... After 3 Words Or Whatever Words You Want Using jQuery
<script type="text/javascript">
jQuery(window).load(function() {
jQuery('.product-grid .home-newproduct .clerk-product .item .product-title a').each(function() {
var strText = jQuery(this).text();
var str2 = strText.replace(/(([^\s]+\s\s*){3})(.*)/,"$1…");
jQuery(this).text(str2.replace(" …","…"));
});
});
</script>