adam291086 Posted December 13, 2007 Share Posted December 13, 2007 Hello I want to create a caption from the text within my database. The text in the database is over 300 character and i want to display around 50. How do i go about doing thi Quote Link to comment Share on other sites More sharing options...
revraz Posted December 13, 2007 Share Posted December 13, 2007 Just display 50 of the 300 with PHP. Quote Link to comment Share on other sites More sharing options...
adam291086 Posted December 13, 2007 Author Share Posted December 13, 2007 this is it i dont know how, i have a basic search running on the database and returning the results. How do i limit the words? Quote Link to comment Share on other sites More sharing options...
themistral Posted December 13, 2007 Share Posted December 13, 2007 Have a look at the substr() PHP function - http://uk2.php.net/substr substr($string, 0, 50); should work for what you want! It will limit characters not words. Quote Link to comment Share on other sites More sharing options...
adam291086 Posted December 13, 2007 Author Share Posted December 13, 2007 is there away to add ............ on the end? Quote Link to comment Share on other sites More sharing options...
themistral Posted December 13, 2007 Share Posted December 13, 2007 echo substr($string, 0, 50) . '...'; Just add however many dots you want at the end after the substring. 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.