School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,433 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,499 people online right now. Registration is fast and FREE... Join Now!




Do I have to copy the HTML for a menu on EACH page?

 

Do I have to copy the HTML for a menu on EACH page?, Main, About, Contact, etc.

papuccino1

2 Jul, 2009 - 07:40 AM
Post #1

C# Programmer
Group Icon

Joined: 2 Mar, 2008
Posts: 943



Thanked: 33 times
Dream Kudos: 50
My Contributions
Hi there,

I'm just curious. I know you can have one single menu and have it load in an iFrame the various subpages of a website (about, contact, etc.) but what if I don't want to use frames?

Do I have to copy the HTML code of my menu on EACH page I create? There must be a better I think (maybe I'm just too use to OO programming).


Thanks for the info.

User is offlineProfile CardPM
+Quote Post


RudiVisser

RE: Do I Have To Copy The HTML For A Menu On EACH Page?

2 Jul, 2009 - 07:56 AM
Post #2

.. does not guess solutions
Group Icon

Joined: 5 Jun, 2009
Posts: 1,872



Thanked: 137 times
Dream Kudos: 125
Expert In: PHP, MySQL, HTML, CSS, C#

My Contributions
Waaa who told you that? biggrin.gif

Never ever use iFrames for something so trivial smile.gif There are multiple methods to do this, the most common would be including a header/footer from PHP... So you'd create 2 files, header.(inc/php/whatever) and footer.(inc/php/whatever).. then include them like so:
CODE
<?php include("header.php"); ?>
<h1>Welcome!</h1>
<p>Whatever content</p>
<?php include("footer.php"); ?>


You could also use SSI (Server Side Includes) which are dependant on web server settings, I can't provide an example.
User is offlineProfile CardPM
+Quote Post

papuccino1

RE: Do I Have To Copy The HTML For A Menu On EACH Page?

2 Jul, 2009 - 07:58 AM
Post #3

C# Programmer
Group Icon

Joined: 2 Mar, 2008
Posts: 943



Thanked: 33 times
Dream Kudos: 50
My Contributions
Wow, completely over my head. I literally didn't understand a single term you used, lol tongue.gif

I'm looking for something a bit more "beginner-like". Thanks for the help.
User is offlineProfile CardPM
+Quote Post

RudiVisser

RE: Do I Have To Copy The HTML For A Menu On EACH Page?

2 Jul, 2009 - 09:35 AM
Post #4

.. does not guess solutions
Group Icon

Joined: 5 Jun, 2009
Posts: 1,872



Thanked: 137 times
Dream Kudos: 125
Expert In: PHP, MySQL, HTML, CSS, C#

My Contributions
Erm, basically you have 3 files (for a standard page):

CODE
footer.php
header.php
index.php


header.php
CODE
<html>
<head>
<title>whatever</title>
</head>
<body>


index.php
CODE
<?php include("header.php"); ?>
<h1>Welcome to my home page!</h1>
<?php include("footer.php"); ?>


footer.php
CODE
</body>
</html>


I don't think I can simplify it anymore sorry sad.gif Including files is like the first thing you learn in PHP I thought.

This post has been edited by MageUK: 2 Jul, 2009 - 09:35 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 12:49AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month