hi,
first i have to say cool site, learn alot here...
okay now to question..
i'm currently working on my php skills and have to say i'm getting rather good at it.. im constructing a status network page and have a little problem
i use a news headline ripper to get a few lines on new news from a local site, there posted in a tabel but this tabel can not expand in height or width...
now i'm search a script or a way to cut of the end of the news headline and replace it with dots so it wil fit into my tabel without expanding....
in this tabel i can have a 35 to 40 caracters...
can someone helpme?
Howto quwestion..!!! [newbie]
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Thanx for the hint...
found a neet little code and it works, had to rearange a little but it works fine...
Credits go to Senty to....! thx man
found a neet little code and it works, had to rearange a little but it works fine...
Code: Select all
/// it breaks at the end of a word ///
$maxTextLenght=125; /// caracters but keep in minde the url has caracters to ////
$aspace=" ";
if(strlen($text) > $maxTextLenght ) {
$text = substr(trim($text),0,$maxTextLenght);
$text = substr($text,0,strlen($text)-strpos(strrev($text),$aspace));
$text = $text.'...';
}
echo "$text"; /// if you (like me) have a list of urls use this 2nd echo to break line and kill <a href>///
echo "</a><br>";
}