O.K. This may be a stupid question, but here goes:
I want to load an external file to supply the text for a given HTML element. I thought I could do something like:
<h1 src = "offsite.txt"></h1>
But that doesn't work. Anyone know how to do that?
This is a discussion on Load text dynamically in straight HTML? within the A Brief History of Cprogramming.com forums, part of the Community Boards category; O.K. This may be a stupid question, but here goes: I want to load an external file to supply the ...
O.K. This may be a stupid question, but here goes:
I want to load an external file to supply the text for a given HTML element. I thought I could do something like:
<h1 src = "offsite.txt"></h1>
But that doesn't work. Anyone know how to do that?
Code:int main(void){srand(time(0));for(double l=rand(),l0=0,l00=0;;l0+=0.1){for(double l000=0;l000 <1;l000+=.001,l+=((double)rand()/RAND_MAX)/0x64,l00+=((sin(l*0x8*atan(l0)*l000-(l0*0x8*atan (l)))*0.5)+0.5)){l00-=floor(l00);for(size_t l0000=0,l00000=(size_t)(0x50*(l00));l0000<l00000;++l0000 )putchar(0x20);putchar(0x61+(int)((double)rand()/RAND_MAX*0x1a));putchar('\n');}}return 0;}
That can't be done (AFAIK) in pure html, since html is executed on the client side. You have to use asp, php or some other server-side script.
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
Look up SERVER SIDE INCLUSIONS.
This is one example that generally works on apache. Dont forget to make sure the SSI parser recognises your file! (Rename to .SHTM / .SHTML / .SSI or whatever your server wants)Code:<!--#include virtual="/path/to/some/text/file.txt" -->
EDIT: If you want to go PURE html, you MIGHT try the object tag, although i dont generally use them, so i cant vouch for their effectiveness.
Code:<OBJECT data="file_to_include.html"> Warning: file_to_include.html could not be included. </OBJECT>
It could be done with an inline frame... (or regular frames for that point, but those are silly)
Away.