<?php
    $descs = explode(' ', $tbldocument->getDocDesc());
    if(count($descs)>50){
        $desc_summary = array_slice($descs, 0, 50);
        echo join($desc_summary, ' ').'...';
    }
    else 
        echo $tbldocument->getDocDesc();
?>