473,387 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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
Expand|Select|Wrap|Line Numbers
  1. <%function smilify(chatText) 
  2.    dim smileys(10) 
  3.    dim smileyGraphics(10) 
  4.    smileys(0) = ":)" 
  5.    smileys(1) = ":S" 
  6.    smileys(2) = ";)" 
  7.    smileyGraphics(0) = "<img src='smiley0.gif'>" 
  8.    smileyGraphics(1) = "<img src='smiley1.gif'>" 
  9.    smileyGraphics(2) = "<img src='smiley2.gif'>" 
  10.    dim fixedText 
  11.    for x = 0 to 9 
  12.       fixedText = replace(chatText, smileys(x), smileyGraphics(x)) 
  13.    next 
  14.    response.write fixed text 
  15. end function 
  16. %>
  17. <% smilify(RSsb("RSmsg")) %>
  18.  
Aug 10 '11 #1

✓ answered by Rabbit

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.

16 2152
Rabbit
12,516 Expert Mod 8TB
That looks like it should work fine. What are you seeing instead of the smilies?
Aug 10 '11 #2
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
Aug 10 '11 #3
Rabbit
12,516 Expert Mod 8TB
You have a space in your variable [fixed text]
Aug 10 '11 #4
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 :(
Aug 10 '11 #5
Frinavale
9,735 Expert Mod 8TB
Are the smiley#.gif files in the same directory as the page?

-Frinny
Aug 10 '11 #6
they are but they are not displaying. i am not even getting the icon for a missing icon
Aug 10 '11 #7
Frinavale
9,735 Expert Mod 8TB
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.
Aug 10 '11 #8
Rabbit
12,516 Expert Mod 8TB
Did you try a fully qualified path?
Aug 10 '11 #9
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
Aug 10 '11 #10
Rabbit
12,516 Expert Mod 8TB
Have you tried using the full path?
Aug 10 '11 #11
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.
Aug 10 '11 #12
Rabbit
12,516 Expert Mod 8TB
Can you repost your current code? You can leave out the connection info if you want.
Aug 10 '11 #13
Here is my Current Code as it stands.
Expand|Select|Wrap|Line Numbers
  1.  <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
  2. <!--#include file="../Connections/******.asp" -->
  3. <%
  4. Dim RSsb
  5. Dim RSsb_numRows
  6.  
  7. Set RSsb = Server.CreateObject("ADODB.Recordset")
  8. RSsb.ActiveConnection = MM_production_STRING
  9. RSsb.Source = "SELECT * FROM dbo.RSshoutbox ORDER BY ID DESC"
  10. RSsb.CursorType = 0
  11. RSsb.CursorLocation = 2
  12. RSsb.LockType = 1
  13. RSsb.Open()
  14.  
  15. RSsb_numRows = 0
  16. %>
  17. <%
  18. Dim Repeat1__numRows
  19. Dim Repeat1__index
  20.  
  21. Repeat1__numRows = -1
  22. Repeat1__index = 0
  23. RSsb_numRows = RSsb_numRows + Repeat1__numRows
  24. %>
  25. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  26. <html xmlns="http://www.w3.org/1999/xhtml">
  27. <head>
  28. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  29. <title>Untitled Document</title>
  30. <style type="text/css">
  31. <!--
  32. body,td,th {
  33.     font-size: 12px;
  34. }
  35. body {
  36.     margin-left: 0px;
  37.     margin-top: 0px;
  38.     margin-right: 0px;
  39.     margin-bottom: 0px;
  40. }
  41. .style2 {
  42.     font-size: 16px;
  43.     font-family: Arial, Helvetica, sans-serif;
  44. }
  45. .style3 {
  46.     color: #FF00FF;
  47.     font-weight: bold;
  48. }
  49. -->
  50. </style></head>
  51.  
  52. <body>
  53. <div align="left" class="style2"><span class="style3"><%=(RSsb.Fields.Item("RSname").Value)%>:</span>
  54.   <%function smilify(chatText) 
  55.    dim smileys(10) 
  56.    dim smileyGraphics(10) 
  57.    smileys(0) = ":)" 
  58.    smileys(1) = ":S" 
  59.    smileys(2) = ";)"
  60.    smileys(3) = ":p" 
  61.    smileys(4) = ":("
  62.    smileys(5) = ";("
  63.    smileys(6) = ":o"
  64.    smileys(7) = ":D"
  65.    smileys(8) = ":$"
  66.    smileyGraphics(0) = "<img src='http://www.cullinan.myep.co.uk/shoutbox/smiley0.png'>" 
  67.    smileyGraphics(1) = "<img src='http://www.cullinan.myep.co.uk/shoutbox/smiley1.png>" 
  68.    smileyGraphics(2) = "<img src='http://www.cullinan.myep.co.uk/shoutbox/smiley2.png'>"
  69.    smileyGraphics(3) = "<img src='http://www.cullinan.myep.co.uk/shoutbox/smiley3.png'>"
  70.    smileyGraphics(4) = "<img src='http://www.cullinan.myep.co.uk/shoutbox/smiley4.png'>"
  71.    smileyGraphics(5) = "<img src='http://www.cullinan.myep.co.uk/shoutbox/smiley5.png'>"
  72.    smileyGraphics(6) = "<img src='http://www.cullinan.myep.co.uk/shoutbox/smiley6.png'>"
  73.    smileyGraphics(7) = "<img src='http://www.cullinan.myep.co.uk/shoutbox/smiley7.png'>"
  74.    smileyGraphics(8) = "<img src='http://www.cullinan.myep.co.uk/shoutbox/smiley8.png'>"
  75.    dim fixedText
  76.    for x = 0 to 9 
  77.       fixedText = replace(chatText, smileys(x), smileyGraphics(x)) 
  78.    next 
  79.    response.write fixedtext 
  80. end function 
  81. %>
  82.   <% 
  83. While ((Repeat1__numRows <> 0) AND (NOT RSsb.EOF)) 
  84. %>
  85.     <% smilify(RSsb("RSmsg")) %>
  86.     <br />
  87.     <% 
  88.   Repeat1__index=Repeat1__index+1
  89.   Repeat1__numRows=Repeat1__numRows-1
  90.   RSsb.MoveNext()
  91. Wend
  92. %>
  93. </div>
  94. </body>
  95. </html>
  96. <%
  97. RSsb.Close()
  98. Set RSsb = Nothing
  99. %>
  100.  
Aug 10 '11 #14
Rabbit
12,516 Expert Mod 8TB
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.
Aug 10 '11 #15
Wow did the trick. only other thing i am having trouble with that code is how to make the images smaller like using the width="16" height="16" style tags
Aug 10 '11 #16
Rabbit
12,516 Expert Mod 8TB
Since that is a new question, please post it in a new thread.
Aug 11 '11 #17

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Cherrish Vaidiyan | last post by:
sir, The following are the steps that i followed in setting up standby database on Red hat Linux 9. i am using Oracle 9i. i have followed the steps in this site : ...
6
by: Marvin Libson | last post by:
Hi All: I am running DB2 UDB V7.2 with FP11. Platform is Windows 2000. I have created a java UDF and trigger. When I update my database I get the following error: SQL1224N A database...
8
by: Kamlesh | last post by:
Hi, How do I know the physical database path of a database. When I goto the DB2INSTANCE users's directory (/home/db2inst1), I see following folders: /db2inst1/NODE0000/SQL00001...
1
by: pintur | last post by:
The message is: SQL1036C Errore di I/O durante l' accesso al database. SQLSTATE=58030 what is the proble? what for restore tables? thanks
10
by: Killer42 | last post by:
Hi all. Where can I find a list of the smilies supported by the vb code syntax? The "list" provided in the FAQ just contains a message describing briefly what a smiley is.
11
omerbutt
by: omerbutt | last post by:
hi there i am making a scrap book application in which i have to populate the smilies as soon as they are written now i am using the textarea to write the input text for the scrap currently i am...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.