How can i short up a text from a database and use a read more>> for example if i receive from database this Fair.Game.2010.LiMiTED.MULTi.1080p.BluRay.x264-LOST (DISTEL) ; Fair.Game.2010.BRRip.AC3.H264-CRYS(sync:enriqo); Fair.Game.2010.DVDSCR.XViD.Absurdity; Fair.Game.2010.DVDSCR.XViD.AC3-T0XiC-iNK; Fair.Game.2010.DVDSCR.XViD-FooKaS. PHP: to be more short like this Fair.Game.2010.LiMiTED.MULTi.1080p.BluRay.x264-LOST (DISTEL) ; Fair.Game.2010.BRRip.AC3.H264-CRYS(sync:enriqo); Fair.Game.2010.DVDSCR.XViD.Absurdity; Fair.Game. Read more>> PHP:
I found i post here maybe helps function myTruncate($string, $limit, $break=".", $pad="...") { // return with no change if string is shorter than $limit if(strlen($string) <= $limit) return $string; // is $break present between $limit and the end of the string? if(false !== ($breakpoint = strpos($string, $break, $limit))) { if($breakpoint < strlen($string) - 1) { $string = substr($string, 0, $breakpoint) . $pad; } } return $string; } PHP: $description = "The World Wide Web. When your average person on the street refers to the Internet, they're usually thinking of the World Wide Web. The Web is basically a series of documents shared with the world written in a coding language called Hyper Text Markup Language or HTML. When you see a web page, like this one, you downloaded a document from another computer which has been set up as a Web Server."; PHP: $shortdesc = myTruncate($description, 300); echo "<p>$shortdesc</p>"; PHP: source http://www.the-art-of-web.com/php/truncate/
Thanks, I was searching for function which looks on break string, . in this case. So it finds dot (".") in that limit and then truncates it to shorter string?
it may be possible to be shorter, but you can use one to a number of limited caracthers (but this trim your word) You can find more examples on the source site i posted.