Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Automate scroller???

  1. #1
    Join Date
    Aug 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Automate scroller???

    1) Script Title: Fading Message Scroller

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...fadescroll.htm

    3) Describe problem:
    I am not having a problem with the scroller. It is working fine. However, I do have a couple of questions. I would like to know if it's possible for any of your scrollers to be automated. I have a file that is populated with sales information by date. What I would like to do is automate that scroller so that it reads the file each day and updates the sales info for that day. Is this possible? I would appreciate any help with this. Thanks.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,136
    Thanks
    44
    Thanked 3,231 Times in 3,192 Posts
    Blog Entries
    12

    Default

    Well, if you could make your external file look like this:

    Code:
    var fcontent=new Array();
    fcontent[0]="<b>What\'s new?</b><br>New scripts added to the Scroller category!<br><br>The MoreZone has been updated. <a href='../morezone/index.htm'>Click here to visit</a>";
    fcontent[1]="Dynamic Drive has been featured on Jars as a top 5% resource, and About.com as a recommended DHTML destination.";
    fcontent[2]="Ok, enough with these pointless messages. You get the idea behind this script.</a>";
    And be named, say - fcontent.js, then you could remove the above lines from the script (be sure to leave especially these and all the other lines in the scroller script):

    Code:
    begintag='<div style="font: normal 14px Arial; padding: 5px;">'; //set opening tag, such as font declarations
    closetag='</div>';
    and put this on your page before the scroller script:

    HTML Code:
    <script type="text/javascript" src="fcontent.js"></script>
    That would do it. In fact, if you wanted to, and have a server side scripting language and data base available for this project, you could have your server generate the file as "fcontent.asp", or "fcontent.php", etc. and use that name as the src attribute. Both php and asp (and other server side languages) can be used to pull variables from the server's data base to construct a file with the proper syntax for the script.
    - John
    ________________________

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

  3. #3
    Join Date
    Aug 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The file as it is now resides on an AS400. Is this still possible or would I have to FTP that file to one of our SQL servers and name it as you suggested?

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,136
    Thanks
    44
    Thanked 3,231 Times in 3,192 Posts
    Blog Entries
    12

    Default

    Fortunately, javascript source files may be accessed across domains, so you could use:

    HTML Code:
    <script type="text/javascript" src="http://www.somedomain.com/fcontent.js"></script>
    The filename's extension can still be .php, .asp, or whatever. Links - source paths to images, etc., if any, within the file should be written either relative to the page that will use them or (preferably) in absolute terms.
    - John
    ________________________

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

  5. #5
    Join Date
    Aug 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default opening the connection

    How would I go about opening the connection to the AS400 to get to that file?

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,136
    Thanks
    44
    Thanked 3,231 Times in 3,192 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by rrnml
    How would I go about opening the connection to the AS400 to get to that file?
    If it is on the internet, just use the file's address as the src attribute.
    - John
    ________________________

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

  7. #7
    Join Date
    Aug 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default not quite

    The file is located in a library on the AS400. I would be using the asp page where the scroller script is to extract from the db file. So I'm thinking I would need to open a connection to that AS400 from there. I just don't know if it's possible.

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,136
    Thanks
    44
    Thanked 3,231 Times in 3,192 Posts
    Blog Entries
    12

    Default

    Hmm, you are moving outside my area of expertise. Ideally the server side/javascript file should be on the server where the db is. Then it can be called by its address from anywhere on the internet. If you have access to both servers, this is the way to go. If you have a way of accessing the db on one server from the other (like if they are linked via an intranet), it could probably be worked out with the server side/javascript file being on the other server but, I have no idea if that could or how that would be done.
    - John
    ________________________

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

  9. #9
    Join Date
    Aug 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default ok

    If I could get that information into an .asp file, what format does that file need to be in, in order to get it to work with the scroller?

  10. #10
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,136
    Thanks
    44
    Thanked 3,231 Times in 3,192 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by rrnml
    If I could get that information into an .asp file, what format does that file need to be in, in order to get it to work with the scroller?
    OK, now we are talking. It needs to be written by the server to appear to the browser as a javascript file. The extension would need to be .asp so that the server will write it. As an example, see this post:

    http://www.dynamicdrive.com/forums/s...66&postcount=1

    where I lay out a method for using a .asp file to compile an array of image names from a given folder. Look at that code and see how it intersperses javascript and asp/VBscript. The server will write out its side of the code, the javascript part is literal, the result would be a file that looks something like this:

    Code:
    var counter=0
    var galleryarray=new Array()
    galleryarray[0]=["some.jpg", "10/24/05"]
    galleryarray[1]=["someother.jpg", "05/07/06"]
    and so on until all the images in the directory are written to the array. This file would be read by the browser and then the script on the page that this file is linked to would have access to the images from the directory as an array.

    You need the server to read your db and have it write out an asp page with an array like this one:

    Code:
    var fcontent=new Array();
    fcontent[0]="<b>What\'s new?</b><br>New scripts added to the Scroller category!<br><br>The MoreZone has been updated. <a href='../morezone/index.htm'>Click here to visit</a>";
    fcontent[1]="Dynamic Drive has been featured on Jars as a top 5% resource, and About.com as a recommended DHTML destination.";
    fcontent[2]="Ok, enough with these pointless messages. You get the idea behind this script.</a>";
    Using your data as the red parts.
    - 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
  •