This is in wordpress (not sure that makes a difference)
This bit of php outputs the post title
if(count($data['nameofpost']) > 20) { echo(substr($data['nameofpost'], 0, 17)."..."); }
For $data['nameofpost'] greater then 20 chars it will output the first 17 plus three dots ....
$data['nameofpost']
...