Results 1 to 9 of 9

Thread: using removetags function

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523

    using removetags function

    When you use the removetags function on a html code it basically removes every html tag there is in the code. This however caused me a little bit of a problem, since it leaves many blank lines after removing the tags. For example this code:
    Code:
    <html>
    <body>
    <whatever tag you want>
    <script>
    </script>
    would produce five blank lines. Do you know how to get rid of these blank lines? THanks for any help.

    Q

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Use the Trim() function to remove whitespaces at the begining and ending of the string.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3
    scoutt
    Guest
    removetags function? where did you get it.

  4. #4
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    I would imagine he meant the strip_tags function

    If so, I don't get the same behaviour you appear to be having with strip_tags

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523
    it is strip_tags actually. Sorry, I couldn't remember the name before.
    If you don't get the same behavior, do you think that it might have something to do with the php settings on the server? Because I certainly do have that problem (on two different servers actually)

  6. #6
    Member
    Join Date
    Apr 2002
    Posts
    52
    chrisjk is probably right in that you don't get that problem with this function, but if the prob remains, do you think you shud do a string replace and replace all "\n" with "" ? essentially, remove the new lines...that are what the blank lines are...

  7. #7
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    It could be a difference in PHP versions too. Functions change in different updates.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523
    I acutally tried that approach (removing \n) - didn't work

  9. #9
    scoutt
    Guest
    what is the code in question?

Posting Permissions

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



Click Here to Expand Forum to Full Width