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

idkew

macrumors 68020
Original poster
What I want to do is make a few lines of code show up on hundreds of html files, maybe a thousand.

Instead of wiring the code in each html file, i want to just write a one word pointer to the code which resides in a different file. can i do this? just tell me what to look for, i will then look it up. you don;t have to explain it if you don't want.

thanks all
 
Well, if you are on a Unix system, you could use sed to stream through all of the HTML files and change the word to something else. You could change thousands of files in a few seconds.

As for doing it via a script or something, I'm not sure how that would be done.
 
if the server thats delivering the pages supports server side includes you can just use an include statement.

<-- #include filename //-->
 
Another way to do it (although if you have access to server side includes, use that) is to use JavaScript. It can be used to write HTML, using "document.write" or "document.writeln".

The downside to this is if someone has JavaScript disabled, they don't see that part of the page. You can use a "noscript" tag to set alternative text/code for those people.

I sometimes create pages (usually forms) that will not work properly without JavaScript. In those cases I'll usually put a snippet of code near the top of the page (note that I'm using a CSS class named "alert" to make this code stand out - often setting the text to bold and red):

<noscript>
<p class="alert">
You have JavaScript disabled in your browser. Please note that this page requires JavaScript to function properly. You may find some things behave strangely or are not available at all.
</p>
</noscript>
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.