Reply
Cascading changes throughout the website - without frames
Old 04-17-2008, 08:40 AM Cascading changes throughout the website - without frames
Novice Talker

Posts: 11
Name: Pritesh Madlani
Hi,

I am currently building a website and am wondering if there is a way that I can change a section on a website once - which then will automatically change on other the other pages.

The website that I am working on is:

http://www.cse.dmu.ac.uk/~p04283218/mainframe8/

As it can be seen - on the left-hand side of the page - there is the navigation section. If I was to add a new link called 'Gallery' (for example), is there an easier way to add it to all the pages - rather than going through them individually?

Your help is much appreciated.
pritmadlani is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 04-17-2008, 09:55 AM Re: Cascading changes throughout the website - without frames
Gilligan's Avatar
Dead Like Me

Posts: 1,572
Name: Stefan
Location: London, UK
Server side includes are most probably what you're looking for, PHP or ASP a just a few examples.

Here's the PHP way:
PHP Code:
<?php include('nav.php'); ?>
and nav.php contains the html code for your navigation menu.
Gilligan is offline
Reply With Quote
View Public Profile
 
Old 04-17-2008, 10:37 AM Re: Cascading changes throughout the website - without frames
Novice Talker

Posts: 11
Name: Pritesh Madlani
Hi,

Thanks for the reply. Unfortunately I am not familiar with php at all. I have a very simple navigation section on the left hand side of the page and have no idea at all - how to put it into php. Do you have any helpful websites or any example scripts of coding that can help me?

Thanks,

Pritesh Madlani
pritmadlani is offline
Reply With Quote
View Public Profile
 
Old 04-17-2008, 10:41 AM Re: Cascading changes throughout the website - without frames
chrishirst's Avatar
Super Moderator

Posts: 11,865
Location: Blackpool. UK
The first question should be what server side code can you run? Because if your host doesn't support PHP no amount of code will help.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 04-17-2008, 10:46 AM Re: Cascading changes throughout the website - without frames
Novice Talker

Posts: 11
Name: Pritesh Madlani
Yeh - as far as I know - the server side does support PHP.

Thanks.
pritmadlani is offline
Reply With Quote
View Public Profile
 
Old 04-17-2008, 10:58 AM Re: Cascading changes throughout the website - without frames
Webmaster Talker

Posts: 560
Hmm this seems to be popular question the past few days. Put your HTML code that will remain consistent and want on all pages inside a file called let's say "navigation.php"

Then, on all the pages you want "navigation.php" to appear, put in its place:

<?php include('navigation.php'); ?>

Doing this on all the pages will allow you to open up navigation.php and make changes, seeing them reflected on all the pages you put the code above.

Matt
170 Designs is offline
Reply With Quote
View Public Profile
 
Old 04-18-2008, 08:14 PM Re: Cascading changes throughout the website - without frames
wayfarer07's Avatar
Insomniac

Posts: 572
Name: Abel Mohler
Location: Asheville, North Carolina USA
The concept of PHP includes is very easy to learn. The paths work exactly the same way they do in HTML, and the include files can be pure HTML, or HTML with PHP. In order to use PHP, however, the file you are writing code in must have a .php extension, not .html. This will not only be very convenient, as you will be able to affect changes on a broad spectrum of your site (such as headers, footers, or navigation), but dynamic sites like this operate much faster, because the PHP is cached by the server, reducing the amount of time the server must work reading form hard disks to generate HTML.
__________________
Go FREELANCE <=====||=====> Hire Me
wayfarer07 is offline
Reply With Quote
View Public Profile
 
Old 04-19-2008, 08:11 AM Re: Cascading changes throughout the website - without frames
Gilligan's Avatar
Dead Like Me

Posts: 1,572
Name: Stefan
Location: London, UK
Heres an easy example

nav.php would contain something like:
Code:
<div>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="reviews.html">Reviews</a></li>
<li><a href="comments.html">Comments</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div>

and in your other html page.. REPLACE THIS
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
</head>
<body>
ANY CODE HERE
<div>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="reviews.html">Reviews</a></li>
<li><a href="comments.html">Comments</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div>
MORE CODE HERE
OTHER STUFF
FOOTER MAYBE ??
COPYRIGHT NOTICE ??
</body>
</html>
with this:
PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
</head>
<body>
ANY CODE HERE
<?php include('nav.php'?>
MORE CODE HERE
OTHER STUFF
FOOTER MAYBE ??
COPYRIGHT NOTICE ??
</body>
</html>
And if you don't want to deal with .htaccess then its best to save you file as *.php
Gilligan is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Cascading changes throughout the website - without frames
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14355 seconds with 13 queries