View Full Version : Calling random text from external file
03-01-2003, 06:09 AM
I am looking for a quick way to update libraries of quotes, either randomly generated or or viewed based on subject, author, text, etc. The key thing I would like to do is have either a text file w/delimiters (if needed), or a js file that holds content. The script would call from the external file. The obvious reason for this is that once one has say hundreds of quotes, it gets messy dealing with arrays, etc. At this point I thought js would be good cause it can be totally client side. The external file of quotes can be added, updated, edited quickly and from anywhere, including my PDA with a text editor. Unless I am missing something in my search through this forum and at other scripting sites, there does not appear to be anything like this. Would love some very specific help as I can do enough coding to tweak scripts but am not a coder by nature.
03-01-2003, 06:31 AM
1. Create a file called quotes.js and enter the quotes like this:
var quote = new Array(20)
quote = "Buy a Pentium 586/90 so you can reboot faster."
quote = "2 + 2 = 5 for extremely large values of 2."
2. Put this code in your HTML file:
Well...that's the general idea...I'm sure you get the picture...anything more complicated than this and I'd recommend using PHP or Perl.
03-01-2003, 06:26 PM
I apologize for the tardy response. Got pulled away and it got late. Thanks for the assist here. At this point I think this is the idea I have to go with unless I move to some other scripting language. I coud do Perl or PHP but really like the idea of being able to have my stuff be portable if at all possible. But I guess I'll crank up my server and play around as well.
03-01-2003, 06:48 PM
Alrighty then...let me know how it goes!
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.