xyn Posted July 2, 2007 Share Posted July 2, 2007 Hey guys, From my earlier function. Basically I was wondering if anyone knows the function which allows you to set like "..." after a set amount of characters. thanks, Ash Quote Link to comment Share on other sites More sharing options...
hackerkts Posted July 2, 2007 Share Posted July 2, 2007 What you can do is use substr() and grab the maximum numbers of character then add "..." after it. Quote Link to comment Share on other sites More sharing options...
corillo181 Posted July 2, 2007 Share Posted July 2, 2007 something like you want one line of text and then .... for like more click some here? user $number=strlen($str); to find out how mane letters are in Quote Link to comment Share on other sites More sharing options...
xyn Posted July 2, 2007 Author Share Posted July 2, 2007 yeh that's basically it. I basically have a script which takes data from a mysql table. then fuinds out the amount of characters, and generates pages from it. But as its done by characters. say 500 characters per page. and the 500 characters exeeds duriong a word... like "Important" and displays "import" I'd prefer "Import..." so then the user knows to click NEXT for the next page. Quote Link to comment Share on other sites More sharing options...
skali Posted July 2, 2007 Share Posted July 2, 2007 function shrink_str($str, $len){ $temp = substr($str,0,$len); $temp = $temp."....."; return $temp; } print shrink_str("abcdefghijklmnopqrstuvwxyz",10); Quote Link to comment Share on other sites More sharing options...
xyn Posted July 2, 2007 Author Share Posted July 2, 2007 thx Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.