Results 1 to 8 of 8

Thread: Pausing up-down scroller(server side integration)

  1. #1
    Join Date
    Apr 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Pausing up-down scroller(server side integration)

    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

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Simple answer:

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

    Code:
    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Apr 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.
    PHP Code:
    <!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>

    <%
    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=" 
    Server
    .MapPath("db\test.mdb")
    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 
    v
    (i)=rs("coursequest")
    i=i+1
    rs
    .movenext:loop
    %>
    <
    script>
    var 
    pausecontent2=new Array()
    pausecontent2[0]="<%=v(0)%>"
    pausecontent2[1]="<%=v(1)%>"
    </script>
    </head>
    <body>
    <script type="text/javascript">
    //new pausescroller(name_of_message_array, CSS_ID, CSS_classname, pause_in_miliseconds)
    new pausescroller(pausecontent2, "pscroller1", "someclass", 2000)
    </script>
    </body>
    </html> 
    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

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Being no PHP expert - I know a smattering of it. I'd suggest opening a new thread on this in the PHP forum.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Apr 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    this is ASP

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Apr 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    i am getting JavaScript errors

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •