View Full Version : Pausing up-down scroller(server side integration)

04-25-2007, 12:54 PM
1) Script Title: Pausing up-down Scroller

2) Script URL (on DD):http://dynamicdrive.com/dynamicindex2/crosstick.htm

3) Describe problem: Hello good pple of the forum, how can i integrate data coming from a database to be displayed using PHP or ASP. THANK YOU

04-25-2007, 01:01 PM
Simple answer:

Just have your server write out the array(s):

var pausecontent=new Array()
pausecontent[0]='<a href="http://www.javascriptkit.com">JavaScript Kit</a><br />Comprehensive JavaScript tutorials and over 400+ free scripts!'
pausecontent[1]='<a href="http://www.codingforums.com">Coding Forums</a><br />Web coding and development forums.'
pausecontent[2]='<a href="http://www.cssdrive.com" target="_new">CSS Drive</a><br />Categorized CSS gallery and examples.'

var pausecontent2=new Array()
pausecontent2[0]='<a href="http://www.news.com">News.com: Technology and business reports</a>'
pausecontent2[1]='<a href="http://www.cnn.com">CNN: Headline and breaking news 24/7</a>'
pausecontent2[2]='<a href="http://news.bbc.co.uk">BBC News: UK and international news</a>'

How this is done exactly, varies by server and can usually be done a number of ways. General guidelines can be found searching on the web. Also, you really don't need to have the server write out the entire array, just its contents. The tricky part is getting the syntax right so that the server understands what data it is pulling and so that the script gets an array in a format that it can use.

04-26-2007, 12:50 PM
hello there as regards the question i asked yesterday i am still stuck.
Now from what i have i was able to get it working sort of.

<!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">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>

Dim conn,rs,sql_select,data_source
set conn=server.CreateObject("ADODB.CONNECTION")
set rs=server.CreateObject("adodb.recordset")
data_source="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
conn.open data_source
sql_select="SELECT * FROM coursequestion_getconnected"
rs.open sql_select,conn,3,1

dim v(1)
dim i
do until rs.eof
var pausecontent2=new Array()
<script type="text/javascript">
//new pausescroller(name_of_message_array, CSS_ID, CSS_classname, pause_in_miliseconds)
new pausescroller(pausecontent2, "pscroller1", "someclass", 2000)

Now, my database will be updated with new records from time to time, so i can't just be displaying two records from it.
Also, some content are in double quotes, some have single and some have both.
So my problem is how do i loop through all the records and escape both single and double quotes at the same time

04-26-2007, 03:00 PM
Being no PHP expert - I know a smattering of it. I'd suggest opening a new thread on this in the PHP forum.

04-26-2007, 04:38 PM
this is ASP

04-26-2007, 04:57 PM
Right, I realized that after you posted in the asp forum about it. Then I saw the asp % you are using. I know a little more about asp than PHP, but not much. Unfortunately, there aren't as many, if any folks in these forums that know asp as there are for PHP. You may need to go elsewhere.

However, where is the problem? Where do the two types of quotes need to be escaped? On the server (asp) side or on the client (javascript) side, both places? You will probably need to determine this in order to find the right kind of help.

Are you getting asp errors or javascript errors?

04-27-2007, 06:20 AM
i am getting JavaScript errors

04-27-2007, 11:33 AM
If you are getting only javascript errors then, at least in theory, you should be able to troubleshoot by viewing the live page's source (view source) in the browser. This will show you the served code. It should then become apparent what you need to VB replace in order to avoid the javascript errors. You should only need to escape one type of quote, the type used to delimit the strings in javascript. You should even be able to choose which type of quote to delimit the strings with. It makes sense to choose the type that is likely to occur with the least frequency in the generated data.