How do I include an html file into another ? I tried so many ways but none of them work. <!--#include file="file.html" --> and #include "file.html"; and many other. Any ideas how I include one html into another ?Using PHP....don't get overwhelmed, it's just one simple command, you don't need to become a programming expert in the language, I'll even give you the code.
Let's say you have file1.html and you want to include file2.html into the first file.
First, rename file1.html to file1.php (you can leave it as html and do some .htaccess stuff, but I'm not familiar with .htaccess, someone else can help you with that if you want to leave it as .html).
Second, place this command in file1.php (formerly file1.html) at the place where you want the contents of file2.html to be included.
<?php include("file2.html"); ?>
That's it...it's easy, and fun.That's always the preferred way. -Does that work 'offline', -or only when hosted 'online'?
In the past I have just used the less-sophisticated <object> tag to insert another html document, like this:
<object type="text/html" data="http://mySite.html" style="width:foopx; height:foopx;"></object>
whereby "foo" is the height/width you wish to insert, and "http://mySite.html" is the page that gets inserted.
I like the php method better though, as <object> inserts a default vertical scrollbar, -even if not need (is is greyed-out if not needed, but visible).Thaks for the solutions. I tried the php one and worked perfectly but I didnt get what I needed. I tried to.... I added a song to play on my website in the index.php file but when someone clicks on another link on my website, the song stops playing so I added the <bgsound src.... on each file. Now when someone from the website clisk on another link the song plays BUT it starts from the beginnig and thats annoying. I want to continue playing if someone is on index.php or index2.php. I red some forums and someone said to make an include file so I did. the file2.html has the: <bgsound src=http://www.webdeveloper.com/forum/archive/index.php/"file.mp3"> so I did the <?php include in each file but again, the song starts from the beginning. Any ideas how can I make it continue playing ?I checked the forum and I didnt see my last message so I posted again but now I see it so I just deleted the contentTo have a song play continuously while your visitor navigates between pages use:
<a href=http://www.webdeveloper.com/forum/archive/index.php/"file.mp3">Play</a>
When someone clicks the link the file will start to play and will continue to play even if the person goes to another page.I tried it and it asks me if I want to save the file or open it. I cliked open and it opened it with windows media player..That was kind of his point, basically embedded music is simply a bad idea. If you really want it then create a pop-up, that loads when and only when a user clicks a link and have your music in that page.
Let's say you have file1.html and you want to include file2.html into the first file.
First, rename file1.html to file1.php (you can leave it as html and do some .htaccess stuff, but I'm not familiar with .htaccess, someone else can help you with that if you want to leave it as .html).
Second, place this command in file1.php (formerly file1.html) at the place where you want the contents of file2.html to be included.
<?php include("file2.html"); ?>
That's it...it's easy, and fun.That's always the preferred way. -Does that work 'offline', -or only when hosted 'online'?
In the past I have just used the less-sophisticated <object> tag to insert another html document, like this:
<object type="text/html" data="http://mySite.html" style="width:foopx; height:foopx;"></object>
whereby "foo" is the height/width you wish to insert, and "http://mySite.html" is the page that gets inserted.
I like the php method better though, as <object> inserts a default vertical scrollbar, -even if not need (is is greyed-out if not needed, but visible).Thaks for the solutions. I tried the php one and worked perfectly but I didnt get what I needed. I tried to.... I added a song to play on my website in the index.php file but when someone clicks on another link on my website, the song stops playing so I added the <bgsound src.... on each file. Now when someone from the website clisk on another link the song plays BUT it starts from the beginnig and thats annoying. I want to continue playing if someone is on index.php or index2.php. I red some forums and someone said to make an include file so I did. the file2.html has the: <bgsound src=http://www.webdeveloper.com/forum/archive/index.php/"file.mp3"> so I did the <?php include in each file but again, the song starts from the beginning. Any ideas how can I make it continue playing ?I checked the forum and I didnt see my last message so I posted again but now I see it so I just deleted the contentTo have a song play continuously while your visitor navigates between pages use:
<a href=http://www.webdeveloper.com/forum/archive/index.php/"file.mp3">Play</a>
When someone clicks the link the file will start to play and will continue to play even if the person goes to another page.I tried it and it asks me if I want to save the file or open it. I cliked open and it opened it with windows media player..That was kind of his point, basically embedded music is simply a bad idea. If you really want it then create a pop-up, that loads when and only when a user clicks a link and have your music in that page.