Is there an html code to use the code from another file?

That guy

New member
Say I have a really long piece of html code saved on a file that needs to appear on several other html files at the same time. The long html code is dynamic (it will be updated regularly), and I don't want to clutter up every file it's used on with the really long code. Is there an html command I can take to use the code from one file and add it to any file with that command?
Big Gryph: I tried that command, but it didn't work.
brisray: The iframe functions isn't working on my computer. Do I have to be on a PC instead of my laptop?
 
You can use the 'include' function, but you have to change the extension for every page that will use that file.

For example, we have a page called 'header.php', and another one called 'body.php' . If you want to include the header file in second one, open body.php and add this code:

<?php include ('header.php') ?>


Now you can do the same thing with other files ... Note that the .php extension doesn't affect your pages!
 
Back
Top