Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

slipper

macrumors 68000
Original poster
Nov 19, 2003
1,561
44
Im just curious if it is possible to have a self updating field on one of my web pages. I operate a tourism website and would like to have one of the local money exchangers to input daily their particular exchange rates. Im not too sure how i would do this or if it is possible... but i was thinking of maybe having a webpage for the money exchanger to input their rates, and somehow have it self update on the site.

Im using iWeb '08
 

slipper

macrumors 68000
Original poster
Nov 19, 2003
1,561
44
Can you please explain this Ruby On Rails thing? Im looking at the site but i am just confused. :confused:
 

toddburch

macrumors 6502a
Dec 4, 2006
748
0
Katy, Texas
Seeing as you are an iWeb user, (and me making the assumption that you are not a website programmer), when you got the suggestion to use Ruby on Rails to accomplish your task, it really was an inappropriate suggestion for you.

Ruby on Rails is a framework with which you create a complete Web Server environment, and requires functional knowledge no less than several programming-related disciplines, of which, your entire investment in using iWeb would be thrown out the door.

If I am mistaken, perhaps the suggester can demonstrate how to do this with Ruby on Rails under iWeb, or, if not do it, perhaps outline the steps to do it.
 

iceblade

macrumors member
Jun 17, 2008
91
0
http://tinyurl.com/5qj2lz

preview.tinyurl.com/5qj2lz (if it makes you feel better.)

A little ways down the page, there is a constantly updating stock ticker price. Is that the kind of thing you are looking for? I don't know how you would do it in iWeb, but maybe you could figure out the code by viewing the source. Maybe someone else can explain it?

Actually, when I found the code, it appears to be Javascript, not ruby on rails or anything. So, I dunno, maybe you guys can explain it. Just something I thought of, hope it can help someone.
 

slipper

macrumors 68000
Original poster
Nov 19, 2003
1,561
44
^^^ thats exactly what im looking for. Something that updates by itself whenever i input information. Like i said i have a little travel website nothing major but i want updated exchange rates and gas prices.

I am definitely not a programmer... LOL.
 

memco

macrumors 6502
May 1, 2008
259
2
What you're asking for is technically possible, but not easy. Since this is probably hosted on a .mac account you would have to rely on javascript to do this. This would require you to edit the code on your page by hand. If this is something you're up for, I'll explain it some more.

Incidentally, I don't have iWeb installed, so I cannot say whether or not iWeb will let you do this. I'll track down my iLife install to check it out.
 

angelwatt

Moderator emeritus
Aug 16, 2005
7,852
9
USA
I figured out something of a possible solution for iWeb using JavaScript.

Put the following into a file named "moneyscript.js"
PHP:
function getFile(pURL) {
   if (window.XMLHttpRequest) { // code for Mozilla, Safari, etc 
      xmlhttp=new XMLHttpRequest();
      xmlhttp.onreadystatechange=postFileReady;
      xmlhttp.open("GET", pURL, true);
      xmlhttp.send(null);
   } else if (window.ActiveXObject) { //IE 
      xmlhttp=new ActiveXObject('Microsoft.XMLHTTP'); 
      if (xmlhttp) {
         xmlhttp.onreadystatechange=postFileReady;
         xmlhttp.open('GET', pURL, true);
         xmlhttp.send();
      }
   }
}
// function to handle asynchronous call
function postFileReady() {
   if (xmlhttp.readyState==4) { 
      if (xmlhttp.status==200) { 
         alert(xmlhttp.responseText);
      }
   }
}
getFile('../money.txt');
Then create a file named "money.txt" with the following content.
Code:
hello world
Saves these files to the desktop or somewhere you can keep track of them. Then head to iWeb. I'll be assuming you have version 2 at least, which has the HTML Snippet feature. Go under Insert and click on HTML Snippet. This will give you a window to add code in. Place the following code in it.
HTML:
<script type="text/javascript" src="../moneyscript.js"></script>
Where this snippet is placed on the page doesn't matter. Now save and publish the site to a folder. Go to the folder where it published. There should be a folder named "Site" inside it. This is where you want to place the files we created earlier (moneyscript.js and money.txt). Now upload the files to the web server and try it out. * Note that the script will not work if you try to view it locally before uploading because it's using a function that only works on a server (generally speaking).

With the way it's currently written this will just bring up a window that says "hello world" and nothing more. I don't really understand what it is you want to happen on your page. The money.txt file would be where this "other person" would go to change these exchange rates. So they would only need to edit a text file. The JavaScript can be further editing to parse out any specific text in that file and add it to the HTML structure and whatnot, but again, not really sure what you're wanting specifically. Another note, you'll need to keep the moneyscript.js and money.txt saved separately because each time you do a Publish to Folder from iWeb those files will disappear as it overwrites the folders. A pain yes.

This is likely going to be one of the easier solutions you can do if you're using iWeb and don't have access to any server side scripting languages (like PHP). So you can see why people haven't been giving much guidance to you.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.