Announcement

Collapse
No announcement yet.

[ url ] [ /url ] tags in ASP or JS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [ url ] [ /url ] tags in ASP or JS

    I've seen a bunch of php boards, etc with the nifty "fake" html tags like [url]. Anyone know where I can get a library or something that would handle doing something like this in ASP or JavaScript? I'm trying to store text in a db and want to allow for simple things like hyperlinks and imgs.

    Something that filters out "bad" HTML would work too, I guess.

  • #2
    www.planet-source-code.com , you might be able to find something there
    1: Pasta <ER>> lol we are gona win this bd talking about porn on our squadchat


    1:EpicLi <ZH>> but should i trust you, you are mean to the ppl
    1:trashed> wha
    1:EpicLi <ZH>> you will hack into my computer and steal my child porn
    1:trashed> i am a very nice person actually.
    1:trashed> i do not steal other's child porn
    1:trashed> i download my own

    sigpic




    1:turmio> i was fucking certain that the first time she would touch me i would come

    Comment


    • #3
      Actually the "fake" HTML is actually called BB Code in which is for easy use on bulletin boards so that our friends who are not familiar with HTML can use the features of it. The BB Code is programmed in PHP and I can actually help you out with it for ASP and JSP just PM me on details or I can email or PM you how to do it for that.

      As for your idea of filtering out "bad" HTML, could you elaborate on this? Not quite sure what this means cuz the only bad HTML tag I know is the <blink> tag :P

      Comment


      • #4
        Ok, were to start, your going to be useing the Replace() command for all of this.

        Code:
        <%
        'Smiles
        strPost = Replace(strPost, "[:)]", "<img border=""0"" src=""smile.gif"">", 1, -1, 1)
        strPost = Replace(strPost, "[;)]", "<img border=""0"" src=""wink.gif"">", 1, -1, 1)
        
        'tags
        strPost = Replace(strPost, "", "<b>", 1, -1, 1)
        strPost = Replace(strPost, "", "</b>", 1, -1, 1)
        strPost = Replace(strPost, "", "<i>", 1, -1, 1)
        strPost = Replace(strPost, "", "</i>", 1, -1, 1)
        strPost = Replace(strPost, "", "<u>", 1, -1, 1)
        strPost = Replace(strPost, "", "</u>", 1, -1, 1)
        'strPost = Replace(strPost, "[IMG]", "<img border=""0"" src=""", 1, -1, 1)
        strPost = Replace(strPost, "[IMG]", "<img src=""", 1, -1, 1)
        strPost = Replace(strPost, "[/IMG]", """>", 1, -1, 1)
        strPost = Replace(strPost, "[HR]", "<hr>", 1, -1, 1)
        strPost = Replace(strPost, "[HR]", "</hr>", 1, -1, 1)
        strPost = Replace(strPost, "[LIST=1]", "<ol>", 1, -1, 1)
        strPost = Replace(strPost, "[/LIST=1]", "</ol>", 1, -1, 1)
        strPost = Replace(strPost, "
        • ", "<ul>", 1, -1, 1) strPost = Replace(strPost, "
        ", "</ul>", 1, -1, 1) strPost = Replace(strPost, "[LI]", "<li>", 1, -1, 1) strPost = Replace(strPost, "[/LI]", "</li>", 1, -1, 1) strPost = Replace(strPost, "
        ", "<center>", 1, -1, 1) strPost = Replace(strPost, "
        ", "</center>", 1, -1, 1) strPost = Replace(strPost, "[P ALIGN=CENTER]", "<p align=center>", 1, -1, 1) strPost = Replace(strPost, "[P ALIGN=LEFT]", "<p align=left>", 1, -1, 1) strPost = Replace(strPost, "[P ALIGN=RIGHT]", "<p align=right>", 1, -1, 1) strPost = Replace(strPost, "[DIV ALIGN=CENTER]", "<div align=center>", 1, -1, 1) strPost = Replace(strPost, "[DIV ALIGN=LEFT]", "<div align=left>", 1, -1, 1) strPost = Replace(strPost, "[DIV ALIGN=RIGHT]", "<div align=right>", 1, -1, 1) strPost = Replace(strPost, "[/DIV]", "</div>", 1, -1, 1) strPost = Replace(strPost, "[P]", "<p>", 1, -1, 1) strPost = Replace(strPost, "[/P]", "</p>", 1, -1, 1) 'Font strPost = Replace(strPost, "[SIZE=1]", "<font size=""1"">", 1, -1, 1) strPost = Replace(strPost, "[SIZE=2]", "<font size=""2"">", 1, -1, 1) strPost = Replace(strPost, "[SIZE=3]", "<font size=""3"">", 1, -1, 1) 'Color strPost = Replace(strPost, "[BLACK]", "<font color=""black"">", 1, -1, 1) strPost = Replace(strPost, "[WHITE]", "<font color=""white"">", 1, -1, 1) strPost = Replace(strPost, "[BLUE]", "<font color=""blue"">", 1, -1, 1) strPost = Replace(strPost, "[/FONT]", "</font>", 1, -1, 1) %>
        Over answered that one... (and if it didn't answer your question... ahhh!!) :P

        edit: vb code messed it up even though it was in the [ code ] tag


        Vitron
        Last edited by Vitron2; 08-19-2003, 03:46 PM.

        Comment


        • #5
          Brilliant. Yeah, the code got a little mangled but it looks pretty easy after seeing most of it written out. I was thinking I'd have to use regexps and parse everything.

          I'll probably just a subset of what you have and add

          Replace(strPost, "<", "&lt;")
          Replace(strPost, ">", "&gt;")

          to kill any HTML sneaking in.

          Thanks.

          Comment

          Working...
          X