Web Analytics Made Easy -
StatCounter forum emocons - CodingForum

Announcement

Collapse
No announcement yet.

forum emocons

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

  • forum emocons

    How would you go about displaying emocons in a forum? I guess you'd search the string for :smile: :wink: stuff like that, then when it find it, it gets replaced with an image tag. How would I go about that? is that basically how its done?
    ~Designer's Toolz~

  • #2
    You'd use str_replace()

    example

    PHP Code:
    $str "hello :)";
    $str str_replace(":)","<img src='smile.gif'>",$str);
    echo 
    $str

    Comment


    • #3
      Where should u put this? On a page that puts things in Forums? Or in a page that displays the forum messages? And: Does this work when you block HTML?
      Cheers MPCODER

      Comment


      • #4
        I personally put them in a function to convert after the mysql query, other's may do it before it's added to the database, I guess it's best to add it into the db to save on resources and such.

        Comment


        • #5
          it works.....well it prints the right code to the tag...but its not being parsed because i have to use htmlentities so what now?
          ~Designer's Toolz~

          Comment


          • #6
            $threadd = htmlentities($thread);
            $threadd = str_replace(":lol:","<img src='/forum/layout/icon_lol.gif'>",$threadd);


            i used that and it works great. Thanks a TON man.
            ~Designer's Toolz~

            Comment

            Working...
            X