Smilies in asp database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • geekynewbie
    New Member
    • Aug 2011
    • 11

    Smilies in asp database

    Hi there, i have a website i am working on and i want to be able to let users use smiles but i cant get them to work. Any ideas here is my main body
    Code:
    <%function smilify(chatText) 
       dim smileys(10) 
       dim smileyGraphics(10) 
       smileys(0) = ":)" 
       smileys(1) = ":S" 
       smileys(2) = ";)" 
       smileyGraphics(0) = "<img src='smiley0.gif'>" 
       smileyGraphics(1) = "<img src='smiley1.gif'>" 
       smileyGraphics(2) = "<img src='smiley2.gif'>" 
       dim fixedText 
       for x = 0 to 9 
          fixedText = replace(chatText, smileys(x), smileyGraphics(x)) 
       next 
       response.write fixed text 
    end function 
    %>
    <% smilify(RSsb("RSmsg")) %>
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    That looks like it should work fine. What are you seeing instead of the smilies?

    Comment

    • geekynewbie
      New Member
      • Aug 2011
      • 11

      #3
      I am getting this error

      Microsoft VBScript compilation error '800a0401'

      Expected end of statement

      /test.asp, line 38

      response.write fixed text
      ---------------------^



      I know there are data in the database, and :) in posts in random places as people post the messages

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        You have a space in your variable [fixed text]

        Comment

        • geekynewbie
          New Member
          • Aug 2011
          • 11

          #5
          I have tried removing that but now it displays the page with no icons or any red cross. it shows it with out any emote :(

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #6
            Are the smiley#.gif files in the same directory as the page?

            -Frinny

            Comment

            • geekynewbie
              New Member
              • Aug 2011
              • 11

              #7
              they are but they are not displaying. i am not even getting the icon for a missing icon

              Comment

              • Frinavale
                Recognized Expert Expert
                • Oct 2006
                • 9749

                #8
                Right click on your page in the browser.
                Find the HTML generated for the smiley's <img> tag and post it here so we can take a look.

                Comment

                • Rabbit
                  Recognized Expert MVP
                  • Jan 2007
                  • 12517

                  #9
                  Did you try a fully qualified path?

                  Comment

                  • geekynewbie
                    New Member
                    • Aug 2011
                    • 11

                    #10
                    http://cullinan.myep.co.uk/shoutbox/test.asp is the web page i am working on and images are on http://www.cullinan.myep.co.uk/shoutbox/smiley2.gif (i am using random images to test it as i got to wait for my designer to sort out the smilies graphics in the morning

                    Comment

                    • Rabbit
                      Recognized Expert MVP
                      • Jan 2007
                      • 12517

                      #11
                      Have you tried using the full path?

                      Comment

                      • geekynewbie
                        New Member
                        • Aug 2011
                        • 11

                        #12
                        Sadly its not working at all. i did try that, I even checked the images are there. The shout box it’s for is automatically updating but even on the static feed it calls from the images are not there.

                        Comment

                        • Rabbit
                          Recognized Expert MVP
                          • Jan 2007
                          • 12517

                          #13
                          Can you repost your current code? You can leave out the connection info if you want.

                          Comment

                          • geekynewbie
                            New Member
                            • Aug 2011
                            • 11

                            #14
                            Here is my Current Code as it stands.
                            Code:
                             <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
                            <!--#include file="../Connections/******.asp" -->
                            <%
                            Dim RSsb
                            Dim RSsb_numRows
                            
                            Set RSsb = Server.CreateObject("ADODB.Recordset")
                            RSsb.ActiveConnection = MM_production_STRING
                            RSsb.Source = "SELECT * FROM dbo.RSshoutbox ORDER BY ID DESC"
                            RSsb.CursorType = 0
                            RSsb.CursorLocation = 2
                            RSsb.LockType = 1
                            RSsb.Open()
                            
                            RSsb_numRows = 0
                            %>
                            <%
                            Dim Repeat1__numRows
                            Dim Repeat1__index
                            
                            Repeat1__numRows = -1
                            Repeat1__index = 0
                            RSsb_numRows = RSsb_numRows + Repeat1__numRows
                            %>
                            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                            <html xmlns="http://www.w3.org/1999/xhtml">
                            <head>
                            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
                            <title>Untitled Document</title>
                            <style type="text/css">
                            <!--
                            body,td,th {
                            	font-size: 12px;
                            }
                            body {
                            	margin-left: 0px;
                            	margin-top: 0px;
                            	margin-right: 0px;
                            	margin-bottom: 0px;
                            }
                            .style2 {
                            	font-size: 16px;
                            	font-family: Arial, Helvetica, sans-serif;
                            }
                            .style3 {
                            	color: #FF00FF;
                            	font-weight: bold;
                            }
                            -->
                            </style></head>
                            
                            <body>
                            <div align="left" class="style2"><span class="style3"><%=(RSsb.Fields.Item("RSname").Value)%>:</span>
                              <%function smilify(chatText) 
                               dim smileys(10) 
                               dim smileyGraphics(10) 
                               smileys(0) = ":)" 
                               smileys(1) = ":S" 
                               smileys(2) = ";)"
                               smileys(3) = ":p" 
                               smileys(4) = ":("
                               smileys(5) = ";("
                               smileys(6) = ":o"
                               smileys(7) = ":D"
                               smileys(8) = ":$"
                               smileyGraphics(0) = "<img src='http://www.cullinan.myep.co.uk/shoutbox/smiley0.png'>" 
                               smileyGraphics(1) = "<img src='http://www.cullinan.myep.co.uk/shoutbox/smiley1.png>" 
                               smileyGraphics(2) = "<img src='http://www.cullinan.myep.co.uk/shoutbox/smiley2.png'>"
                               smileyGraphics(3) = "<img src='http://www.cullinan.myep.co.uk/shoutbox/smiley3.png'>"
                               smileyGraphics(4) = "<img src='http://www.cullinan.myep.co.uk/shoutbox/smiley4.png'>"
                               smileyGraphics(5) = "<img src='http://www.cullinan.myep.co.uk/shoutbox/smiley5.png'>"
                               smileyGraphics(6) = "<img src='http://www.cullinan.myep.co.uk/shoutbox/smiley6.png'>"
                               smileyGraphics(7) = "<img src='http://www.cullinan.myep.co.uk/shoutbox/smiley7.png'>"
                               smileyGraphics(8) = "<img src='http://www.cullinan.myep.co.uk/shoutbox/smiley8.png'>"
                               dim fixedText
                               for x = 0 to 9 
                                  fixedText = replace(chatText, smileys(x), smileyGraphics(x)) 
                               next 
                               response.write fixedtext 
                            end function 
                            %>
                              <% 
                            While ((Repeat1__numRows <> 0) AND (NOT RSsb.EOF)) 
                            %>
                                <% smilify(RSsb("RSmsg")) %>
                                <br />
                                <% 
                              Repeat1__index=Repeat1__index+1
                              Repeat1__numRows=Repeat1__numRows-1
                              RSsb.MoveNext()
                            Wend
                            %>
                            </div>
                            </body>
                            </html>
                            <%
                            RSsb.Close()
                            Set RSsb = Nothing
                            %>

                            Comment

                            • Rabbit
                              Recognized Expert MVP
                              • Jan 2007
                              • 12517

                              #15
                              Sorry, I should have caught this way earlier. Change all references of fixedText to chatText. You are replacing your fixedText value every time without keeping the results.

                              Comment

                              Working...