Jump to content

Sharing Same HTML of several webpages


Err

Recommended Posts

Hello.I didn't know where to post this, I think it's more of an HTML problem then anything else so...I'm designing a site that uses a header/footer/navigation on all my webpages that I have. My question is, is there a way to repeat the header or anything else I want on to different pages without painfully going in and adding these dreaded things on to every single webpage that I have? I know about SSI, but that's out of the question for me. I've seen some other webpages like CSS Play that have something like that going on and they have no need to change the file extension to .php to get that effect. I want to stick with just the plain old .html file extensions. Any help on this subject would be awsome. :)

Link to comment
Share on other sites

Thanks a lot Little Goat! I will certainly put that info to use. :) In any case, if anyone has any more input on this subject, please drop me a line or 2.

Link to comment
Share on other sites

If you have PHP, this is an easy way. Just up the first code into you nav, and the 2nd into your body...

Use this script:It is every easy to use,  you upload all you files to a folder.The insert this php, point to the folder with the files. and it will make the pages.It will make links to its else but change the data in the body:Links Script:
<?php// This would go in a nav bar or something...// Go to data$filename= "/location/to/folder/with/data/";// Open the folder$dir = opendir("$filename");// Read the folderwhile(false != ($file = readdir($dir))){// Find all files	if(($file != ".") and ($file != ".."))	{// make a link to every file!  $tempfile = explode('.', $file);  print "<a href='index.php?page=$tempfile[0]'>$tempfile[0]</a><br />";	}}?>

This would go in the body

<?php//This would go in the body of the document (where you want the text)...//Get the page you want to see$page = $_GET['page'];if($page == null){print "Please click a link to view a page<br />This is really the first page they will see, you should add the beginning page here.";}else{//you will need to put the document ext in for ext (2 lines down)!// Display the pageinclude "/location/to/folder/with/data/$page.ext";}?>

If you point to word documents You will get some junk at the start and end of the files being included.

Link to comment
Share on other sites

Depends on if you want to load the body into the page or load the nav and header into the page.Large sites with 100,000 pages do it with my script.smaller sites (like my own) use Little Goat's script.All that include will do will make it easier to update your website's layout. include will also slow down you loading time...

Link to comment
Share on other sites

I want to load 3 things into my webpages, that would be my header, navigation, and my footer. I was reading more up on SSI, seems like I was a bit mistaken, you can have SSI with .html file extensions, with the exeption that the servers allow it. I have yet to try this out. The server that I'm on seemed to have craped out on me (I guess that's what I get for getting a free web hoster), but once it comes back online, I'll tell you guys what happened. Like I said, I don't want to change my file extension to .php if I don't have to. Thanks again guys. :)

Link to comment
Share on other sites

There stupid servers currently have it disabled... *sighs* Well, nothing I can do. Javascript I don't want to use, what if the user decides to disable it? I guess I have to wait it out. Thanks for all the replies. :)

Link to comment
Share on other sites

I would recommen using inclue('file.ext')...heres coding:file.html

your nav bar coding here

home.php

<html></body>coding here<?php include('file.html'); ?>coding here</body></html>

hope that helps :)

Link to comment
Share on other sites

Use a server-side coding like PHP, ASP, or CFW. If one or all of those are unavailable, I would actually hand-code the HTML files if they were 10 or less of them.If there are too many, use Frames. Frames are more widely supported than javascript in older and text browsers

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...