SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Dec 2006
    Posts
    430
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    stopping a search string at X mount of words

    Hi Guys,

    when i output asearch result in my code it displays the entire paragraph/post for example:

    if i search for "output" it displays:

    PHP Code:
    when i output  asearch result in my code it displays the entire paragraph/post for example
    but i was wanting to cap it at sat 50 characters like:

    PHP Code:
    when i output  asearch result in my code it displays the entire paragrap...[/ 
    then when you click on the link it shows you the complete paragraph

    im not sure how to go about this any help would be great

    cheers

    Graham

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    evening graham, you need to look at substr(); Have a look through the user notes as there are a few function there that split words at spaces rather than in the middle of a word.
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    SitePoint Evangelist
    Join Date
    Dec 2006
    Posts
    430
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks spikeZ that's what i'm after

    Graham


Bookmarks

Posting Permissions

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