PHP: Trimming the text in a link?

Jessi Ray

New member
Hello yahoo answers. PHP noob here.

I am building a webpage and would like to trim how big the links for forum post are... I am displaying recent forum post on my side bar, but sometimes, the titles are too long and need trimming. For example...

A titles post like:
Hey guys I love yahoo answers

Should be abbreviated to:
Hey guys...

Here is the PHP for plugging the links:


while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {

echo "<a href=\"$urlPath/viewtopic.php?f=$row[forum_id]&t=$row[topic_id]&p=$row[post_id]#p$row[post_id]\" class=\"nav2\" TARGET=\"_blank\">" .
$row["topic_title"] .
"</a> <a href=\"$urlPath/memberlist.php?mode=viewprofile&u=$row[user_id]\" TARGET=\"_blank\">" .



"";
}

mysql_free_result($result);
mysql_close($link);

If you need to see the whole script, I can post it, just let me know. Thank you in advance!
I don't think you're understanding Bella, it's working fine as is... I just need the post titles abbreviated.

The post titles are represented by ["topic_title"] in the snippet I posted.
 
Back
Top