Thread: Text too long
View Single Post
(#10)
Old
gregbatch gregbatch is offline
Senior Member
gregbatch is on a distinguished road
 
Posts: 121
Join Date: Jun 2006
Default 02-28-2007, 09:02 PM

Replace:

$output.=$loop[$x][title] ."<br />";

With:

$limit = '25'; // Set to your preference
$textin = $loop[$x][title];
if(strlen($textin)>$limit){
$textin = substr($textin,0,$limit);
$textout = substr($textin,0,-(strlen(strrchr($textin,' '))) )."…";}
else{$textout = $textin;}
$output.=$textout ."<br />";


This shortens the string to whatever you specify as the limit, drops any word fragment, and ads the ellipsis (…)


Greg
3.1.4 Designer
www.valleywantads.com

Last edited by gregbatch : 02-28-2007 at 09:33 PM. Reason: correction
Reply With Quote