943,829 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Jul 1st, 2009
0

More than one Html page.

Expand Post »
Hi,
I have designed one html page (home) with CSS. I have four more pages in html and want my heading and menus to be repeated. How should i do it? Do i have to write all the heading and menu contents in each of my pages or is there any other ways. Please help..

Thank you,
Siji
Similar Threads
Reputation Points: 10
Solved Threads: 1
Newbie Poster
siji44 is offline Offline
12 posts
since May 2007
Jul 1st, 2009
0

Re: More than one Html page.

You can use a PHP include, if you are using php. Create a file for your header and menus and name it something like header.php & menus.php. (they can be separate or together in one file) You can create one for your footer, too.

Then, on every page you want them, include them with php like this:
<?php include("header.php"); ?>
Your html pages need the .php extension for this to work.

Your page might look like this:
HTML and CSS Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <title>Title</title>
  4. </head>
  5.  
  6. <body>
  7. <?php include("header.php"); ?>
  8. <p>SOME CONTENT</p>
  9. <?php include("menus.php"); ?>
  10. <p>MAIN BODY CONTENT
  11. ...
  12. ...
  13. </p>
  14. <?php include("footer.php"); ?>
  15.  
  16. </body>
  17. </html>

The header file might look like this:

HTML and CSS Syntax (Toggle Plain Text)
  1. <img src="LOGO.JPG" />
  2. This is our website slogan...

The footer might look like this:

HTML and CSS Syntax (Toggle Plain Text)
  1. <p>
  2. &copy;Copyright 2009 by My website.com
  3. </p>
  4. <p>
  5. contact us anytime!
  6. </p>
Reputation Points: 10
Solved Threads: 1
Light Poster
drumichael87 is offline Offline
33 posts
since Jun 2009
Jul 1st, 2009
0

Re: More than one Html page.

thank you, ill try this.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
siji44 is offline Offline
12 posts
since May 2007
Jul 1st, 2009
0

Re: More than one Html page.

hi siji44,

Honestly, its only four pages, don't think you need to go php. simply repeat your header divs using the same classes and if you coded it right, once you change your classes, all your pages will be changed as well.

Easy stuff!
Reputation Points: 46
Solved Threads: 48
Posting Pro in Training
macneato is offline Offline
413 posts
since Jun 2007
Jul 1st, 2009
0

Re: More than one Html page.

Click to Expand / Collapse  Quote originally posted by macneato ...
Honestly, its only four pages, don't think you need to go php.
please ignore this advice,
plan on expansion,
plan on 100,000 pages, and the database to support them, and the design features to import a single css and javascript file, and to php/ssi/cgi/asp(your choice) include all the common code.

Do it now when it is four pages, and you dont have to come back in a month and rewrite 40, come back in six months to rewrite 400 or more, and decide what code can be common.

imagine for example Wikipedia without the includes, and backend, every page requiring Joe Public to hand code menus to millions of other pages, for a minor edit .....
Dont think anyone would like to make edits
( WikiPedia is chosen as a design model that works )
Last edited by almostbob; Jul 1st, 2009 at 4:49 pm.
Reputation Points: 562
Solved Threads: 368
Posting Maven
almostbob is online now Online
2,970 posts
since Jan 2009
Jul 1st, 2009
0

Re: More than one Html page.

I also may recommend framesets. You can look into that, i recommend for almost all web programming: www.w3schools.com.
Last edited by u8sand; Jul 1st, 2009 at 11:05 pm.
Reputation Points: 78
Solved Threads: 15
Junior Poster
u8sand is offline Offline
131 posts
since Dec 2008
Jul 1st, 2009
-7

Re: More than one Html page.

Frames are a bit clumsy, and lost of mobile browsers dont support them very well
Moderator
Featured Poster
Reputation Points: 1764
Solved Threads: 574
Moderator
jbennet is offline Offline
16,510 posts
since Apr 2005
Jul 2nd, 2009
0

Re: More than one Html page.

You are actually being quite ridiculous bob. Wikipedia is probably the worst example you could think of. It's like you telling him (in lame-mans terms) to build a factory, it can do EVERYTHING FOR YOU when he will only be manufacturing 5 products. Not every site grows exponentially.

If you planning on building a large site, i would recommend going CMS there are alot of open source solutions available. This will save you development time and templating is relatively simple.
Reputation Points: 46
Solved Threads: 48
Posting Pro in Training
macneato is offline Offline
413 posts
since Jun 2007
Jul 2nd, 2009
0

Re: More than one Html page.

Click to Expand / Collapse  Quote originally posted by macneato ...
You are actually being quite ridiculous bob. Wikipedia is probably the worst example you could think of. It's like you telling him (in lame-mans terms) to build a factory, it can do EVERYTHING FOR YOU when he will only be manufacturing 5 products. Not every site grows exponentially.

If you planning on building a large site, i would recommend going CMS there are alot of open source solutions available. This will save you development time and templating is relatively simple.
I am, arent I...

Siji44, plan on some expansion,
There will always be a few more changes to make, additional pages
if you arent going to use some includes, make a template you can paste content into, with the head scripts appearance set
Reputation Points: 562
Solved Threads: 368
Posting Maven
almostbob is online now Online
2,970 posts
since Jan 2009
Jul 21st, 2009
0

Re: More than one Html page.

I think everyone's opinion is valid. Give the person asking the question some information, and let him make his own informed decision!

=)
Reputation Points: 10
Solved Threads: 1
Light Poster
drumichael87 is offline Offline
33 posts
since Jun 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: Image resizw problem
Next Thread in HTML and CSS Forum Timeline: Send text messages from my website





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC