Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Feb 2011
    Posts
    95
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Read more... if text more than 600 charcters

    I am wanting to display large text blocks from a database but i would like to stop the text if its longer than 600 characters and display Read more... as a link.

    Can someone please help me?

  2. #2
    Master Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    5,100
    Thanks
    109
    Thanked 602 Times in 589 Posts
    Hi Nealec, glad to see you're still at it

    I think this would be suited to the str_len function. I say think because i don't know how it handles large texts from mysql etc.

    The following worked well for me when i ran it through my code tester - change the 10 to 600:
    PHP Code:
    $Test 'teslkjlfgjg oigjsd ofjslfjsdfjsdlfjsdiofjslk nslkfj lsdkfj sdlfjdlskf jk';

    if (
    strlen($Test) > 10)
       {
       print 
    substr($Test010);
       } 
    Quote Originally Posted by deathshadow View Post
    So seriously, loosen up that tie, let out the belt, and try relating to normal people on the street instead of the gentleman's club crowd.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •