Results 1 to 5 of 5

Thread: HTML block

  1. #1

    Thread Starter
    Fanatic Member invitro's Avatar
    Join Date
    Jan 2000
    Location
    Outside your window
    Posts
    547

    HTML block

    This is a lame question and I feel lame for asking it but its late and I dont have time to search on google.

    What i need to do is output text from a databse. Problem is, this text can contain things like <A HREF="">whatever</a>

    I want the text to show just as text, not links and javascript the usermight want to embed.

    Isent there a <SCRIPTBLOCK> or something you can use?
    ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet?

  2. #2
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    There are tags like <xmp></xmp> you can use. I know they are trying to phase out <xmp>, so don't use it. I can't remember what they recomend instead though.

    I presume You're using PHP to grao it out of the DB, you could replace all < and > with the actual thingies (hard to explain, code easy to show):
    PHP Code:
    $str str_replace("<","&lt;",$str);
    $str str_replace(">","&gt;",$str); 
    Have I helped you? Please Rate my posts.

  3. #3
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    You can use php's htmlentities
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  4. #4

    Thread Starter
    Fanatic Member invitro's Avatar
    Join Date
    Jan 2000
    Location
    Outside your window
    Posts
    547
    I'm actually using ASP, sorry should have specified.
    ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet?

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    ASP should have something similar, if not, just do a string replace to replace all '<' by "&lt; and all '&' by "&amp;".

    In true XHTML, you could use CDATA sections. Alas, IE doesn't support true XHTML.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your 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