Serving webpages from SD card including live sensor data

Hi, after playing with my new ethernet +SD shield, I have have had some success with serving up webpages and sensor data. From what I have learned so far, there are 2 main methods:

  1. Using a sketch which enables a full HTML based website structure saved on the SD card to be served.

  2. Using a sketch which creates the webpage from html contained in client.print() statements.

Both work well, but are limited - method 1 can serve an elaborate website, with content limited only by the size of the SD card, my HTML skills, and what is on the SD card. Method 2 is great for serving the live sensor data, but very limited in the amount of information which can be written to the website. I have already had to learn to use progmem to store the text data to save on memory.

So my question is - what would be the best approach to combine the 2?

The only way I can think of is to write the sensor data to a .csv file on the SD card, then in the html have some kind of query which can pull that data into the webpage at the same time. Although if this is possible, it is beyond my current skills...

Any ideas?

Thanks!

So my question is - what would be the best approach to combine the 2?

Dump "method 1" as it just irritates people and slows downloading.

Check out pachube.com

An ethernet arduino shield with SD card on it will provide the hardware the rest is code.

OR

if you can get a chipkit/Maple or OLIMEX STM32 they are arduino compatible with the Arduino IDE and have a SD card slot on them(though card is not included) , then you can utilize the WiFi shield to serve webpages , the one like Async labs v1 or v2 is a nice thing that will get you started with a boost.

So my question is - what would be the best approach to combine the 2?

You could have two (or more) files on the SD card - part1.htm and part2.htm. Read and return part1.htm (the static part of the page). Send live sensor data. Read and return part2.htm (the rest of the static content).

The stream of data being received at the client side will bear no indication of whether it was read from an SD card, read from SRAM, generated dynamically, or made up at using a random letter generator.

Thanks all for the ideas.

PaulS - sounds like a neat solution, although I'm really aiming to have the dynamic sensor data inserted somehow on the same page as the static SD served page.

If you put a file together that contains:

Screwy stuff

and another file that contains

and you send file 1, some generated stuff, and file 2, the client will receive something like:

Screwy stuff . . . and the browser will have no idea that the part was dynamically generated while the other stuff was statically defined. It will all look the same to the browser.

OK, I see...thanks very much