combine html file on ethernet shield SD and html in the code

Hello, I have made a web server, where I sent each line of HTML separately to the client. I give a cut down example below. I now need to store the html as a file on the SD card on the ethernet shield because it takes up too much program memory (the html is lengthy) but I still need to include the IF statements, which are included in the "PinONorOFF function seen below. My question, is there a way to put most of the HTML on the index.html file on the SD card, but also refer to the function to grab the next line, at a particular time?

client.println("This is my webpage");
client.println("This is the 2nd line of my webpage");

but then I created a function that would determine what is sent as the 3rd line of the webpage

void PinONorOFF(EthernetClient cl)
if (digitalRead(8)==HIGH){
cl.println("3rd line of webpage says this");
else if (digitalRead(8)==LOW){
  cl.println("3rd line of webpage now says this instead");


You may not have to go that far. If your web page is shorter than 32k bytes you can keep the text in FLASH instead of the default which is to copy it to SRAM (of which you only have 2k).

client.println(F("This is my webpage"));
client.println(F("This is the 2nd line of my webpage"));
void PinONorOFF(EthernetClient cl) {
  if (digitalRead(8)==HIGH){
    cl.println(F("3rd line of webpage says this"));
  } else if (digitalRead(8)==LOW){
  cl.println(F("3rd line of webpage now says this instead"));

If you try that you might find that you don't need an SD card.

Thank you JohnWasser,

I will look into that, I'm still fairly new to programming, so I will need to look into how to copy it to FLASH. Would you mind pointing me in the right direction? Thank you. I appreciate your response.

Sorry JohnWasser, I see now how you added the F's in there. Thank you.

It all fit and compiled after sending it all to FLASH instead. Thanks a million!

katana_flyer: It all fit and compiled after sending it all to FLASH instead. Thanks a million!

If it grows in size to no longer fit, create two html files on the SD card. Send the first one. Send the dynamic data. Then send the second one.