Pulling In External Details

  • tommya
  • Graduate
  • Graduate
  • tommya
  • Posts: 221
  • Loc: United Kingdom

Post 3+ Months Ago

I have a requirement to list current Exchange Rates on my companies intranet, but rather than rely on people to feed me the correct rates, I want them to be able to update them themselves.

I propose to simply create the table, with 2 columns, left hand column containing the currency (USD, GBP etc...) and the right column containing the value.

I would like the right-hand column to pull in the values from an external file, so that Accounts and update the file as necessary, rather than relying on me to do it.

Is there any way I can do this?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

I'm moving this one to programming - you're probably going to need some type of script to accomplish this.
  • bob9999
  • Newbie
  • Newbie
  • bob9999
  • Posts: 11

Post 3+ Months Ago

This is pretty simple to do with PHP.

Create a PHP page with code to do the following everytime the page loads:

Open the external file (you may want to cache data from a remote file on your server & update it every few hours)

Parse the file for the exchange rate (may need to use regular expressions if the file isn't structured)

Build the exchange rate table on the fly as the page is loaded.

That's the outline of what's needed, details in implementation will vary.

I hope this helps,

Bob

tommya wrote:
I have a requirement to list current Exchange Rates on my companies intranet, but rather than rely on people to feed me the correct rates, I want them to be able to update them themselves.

I propose to simply create the table, with 2 columns, left hand column containing the currency (USD, GBP etc...) and the right column containing the value.

I would like the right-hand column to pull in the values from an external file, so that Accounts and update the file as necessary, rather than relying on me to do it.

Is there any way I can do this?
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

Care to give some details on your companys intranet ?
For instance, can you use ASP, PHP, what browsers are you using ?, Is javascript enabled ? there is literally 101 ways to accomplish what your trying to do.
  • tommya
  • Graduate
  • Graduate
  • tommya
  • Posts: 221
  • Loc: United Kingdom

Post 3+ Months Ago

I can use php + I believe asp works also.
I've been trying to learn PHP lately, with a little success, but not sure I'm confident enough on it as yet to start writing anything big, but I'm getting there.

What 101 ways do you have in mind (no obligation to list them all of course :) )

Tommy
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

Somthing like this ? // Removed - Joebert

It's ASP & XML based
  • tommya
  • Graduate
  • Graduate
  • tommya
  • Posts: 221
  • Loc: United Kingdom

Post 3+ Months Ago

that looks great for updating, but are the new values then stored somewhere, because I want the current values to load on the intranet home page everytime it is opened.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

EDIT: If you want to make sure you can use asp copy this,
Code: [ Select ]
<%
Dim testing,color
testing = "Hello ASP!"
color = "7788FF"
%>
<html>
<body bgcolor="#<%= color %>">
<%= testing %>
</body>
</html>
  1. <%
  2. Dim testing,color
  3. testing = "Hello ASP!"
  4. color = "7788FF"
  5. %>
  6. <html>
  7. <body bgcolor="#<%= color %>">
  8. <%= testing %>
  9. </body>
  10. </html>

into notepad and save on the server with an ASP extension. If you get a light blue screen with the words "Hello ASP!" your good to go.
(bet thats the first time you looked foward to a bluescreen :lol: )

Now about this solution,
It stores the data in an XML file in the same directory. If you can use ASP then follow this link to a text file and proceed with the following instructions,

// Removed - Joebert
MIRROR
// Removed - Joebert

Now you need to either create a new folder to put theese in or change ALL references to DEFAULT.ASP to the filename of your choosing if you want to put them in a folder that allready has a DEFAULT.ASP

Now in the text file you linked to You should see alot of source code with ---------- lines every so often.

You need to paste the parts between theese lines into a text editor and save each as the filename noted at the top of each.

Example: seeing this,
Code: [ Select ]
-----------------------------------
This is a form to determine how many rates there will be
START.HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Define Max exchange rates</title>
</head>
<body>
Enter the total number of rows.
<form action="build.asp" method="post">
<input type="text" name="max" /><br />
<input type="submit" value="Build XML" />
</form>


</body>
</html>

------------------------------------
  1. -----------------------------------
  2. This is a form to determine how many rates there will be
  3. START.HTML
  4. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  5. <html>
  6. <head>
  7. <title>Define Max exchange rates</title>
  8. </head>
  9. <body>
  10. Enter the total number of rows.
  11. <form action="build.asp" method="post">
  12. <input type="text" name="max" /><br />
  13. <input type="submit" value="Build XML" />
  14. </form>
  15. </body>
  16. </html>
  17. ------------------------------------

You would paste this,
Code: [ Select ]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Define Max exchange rates</title>
</head>
<body>
Enter the total number of rows.
<form action="build.asp" method="post">
<input type="text" name="max" /><br />
<input type="submit" value="Build XML" />
</form>


</body>
</html>
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>Define Max exchange rates</title>
  5. </head>
  6. <body>
  7. Enter the total number of rows.
  8. <form action="build.asp" method="post">
  9. <input type="text" name="max" /><br />
  10. <input type="submit" value="Build XML" />
  11. </form>
  12. </body>
  13. </html>

Into notepad and save it as START.HTML

When your done you should have,
build.asp
fill.asp
rates.asp
start.html
update.asp
default.asp

Start.html and Fill.asp will only be used once to build the initial structure of the XML file that the rest of the pages will use as a database, Though you could modify them for adding more rates later on.

Now that you have all your files use your browser and navigate to START.HTML
Enter the total number of rates in the box and click the button.
This will take you to a form with boxes to enter the initial names and numbers for the X amount of rates you choose. Fill theese in and click the button.

You should now see nothing but the word SUCCESS as a link. Click it and
you should be at the example I posted on OZZU before.

Now you have the basic structure, you can start using it from DEFAULT.ASP

If you want to change the layout of the tables remember this,
Code: [ Select ]
<%= rateOut %>

That is your data formated into TR/TD tags with no headers.
Each name cell is classed as "name", each rate cell is classed as "rate" and each update cell is classed as "change" if you want to apply CSS formating to them.
You can change the table tag around that "rateOut" tag if you what to change overall apperance.

After you have tweeked the layout to what you want it to look like give the address to DEFAULT.ASP (Or just the path to the folder if you haven't tweaked default page settings.) to anyone that needs to reference it.

I think I covered Everything, If not Feel Free to ask Questions :D
EDIT: Just noticed you want the rates to appear on your homepage as well, heres what you do,
Paste everything between
Code: [ Select ]
<%
%>
  1. <%
  2. %>

From the DEFAULT.ASP file Into the top of the homepages source.
You may have to add the name of the folder that you placed all this in to this line.
Code: [ Select ]
objXML.load(server.mappath("rates.xml"))

Might be
Code: [ Select ]
objXML.load(server.mappath("new/rates.xml"))


Once that is done remember what I explained about the formating above. Also you might want to add a link back to the homepage In UPDATE.ASP

If this causes your homepage to display the source instead of your page as intended you may have to copy the home page and save it with an ASP extension (DO NOT DELETE OR RENAME THE ORIGINAL UNTILL YOUR SURE EVERYTHING WORKS)

Ok NOW I think I got everything, like before feel free to ask questions.[/code]

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 123 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.