Forum Moderators: coopster
"Cut" a big description and put ... at then end and a link that says "More info" that goes on the full description... I'm getting my description from a database... I'm just looking for the part that "cuts" the description...
Example :
Blah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah ¦¦¦ CUT ¦¦¦ (add "... More info", when you click you get the rest of the description->) blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahvvvBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blahBlah blah
$shorty = substr [ca2.php.net](string,0,50);
$shorty .= ".... <a href=\"somelink.html\">More info</a>";
$shorty = preg_replace("/[^\.:!\?\)]*$/","",substr(string,0,100));
$shorty .= ".... <a href=\"somelink.html\">More info</a>";
That way it will trim at the end of the sentance before the 100 char mark. If you just want it not to cut the middle of a word, use:
$shorty = preg_replace("/[^ ]*$/","",substr(string,0,100));
$shorty .= ".... <a href=\"somelink.html\">More info</a>";