01-13-2010, 09:08 PM
|
#2 (permalink)
|
|
The Wanderer
Join Date: Aug 2008
Posts: 21
Thanks: 1
|
Do you mean like this ?
PHP Code:
<?
$str = "Yeah, but on my website, before I realized that converting quotes, etc, to entities was a bad idea, I already had a lot of stuff put into a database...Also, symbols like show up as question marks... and I don't really know how to fix that. In my four years of HTML experience, and two years of PHP experience, I've never been able to get character encoding to do what I want it to.";
$chars = "150";
function shortText($str, $chars) { if (strlen($str) > $chars) { $str = substr($str, 0, $chars); $str = $str . "<a href='/link-to-full-article.html'>...</a>"; return $str; } else { return $str; } }
echo shortText($str, $chars);
?>
So you can click on the 3 dots to go to the full page ?
or do you just mean echo($str); ?
|
|
|
|