Web Design Forum: CSS Help - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CSS Help

#1 User is offline   Stringer 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 18-December 08
  • Reputation: 0
  • Experience:Beginner
  • Area of Expertise:Photographer

Posted 18 December 2008 - 07:28 PM

Hi,

I'm new to using CSS and have learnt quite a bit waching teh Learning Series on Youtube but have got to a point where I need some help

I'm basically wanting to know how I go about making a menu a seperate entity to the rest of the site

Sort of like so I only have to amend one file (menu) and it amends it on all further pages witin the website

Is this possible and how would I go about doing it?

Thanks
Paul
0

#2 User is offline   dores 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 14
  • Joined: 21-November 08
  • Reputation: 0
  • Location:UK
  • Experience:Web Guru
  • Area of Expertise:Web Designer

Posted 18 December 2008 - 07:39 PM

Its very easy. just create another css file with the styles for the menu alone and link that file too.

ie.

<head>
<LINK REL=StyleSheet HREF="style.css" TITLE="main css">
<LINK REL=StyleSheet HREF="menu.css" TITLE="menu css">
</head>

0

#3 User is offline   craftedpixelz 

  • Expert
  • PipPipPipPip
  • Group: Members
  • Posts: 644
  • Joined: 28-June 08
  • Reputation: 5
  • Gender:Male
  • Location:Manchester, UK
  • Experience:Web Guru
  • Area of Expertise:Web Designer

Posted 18 December 2008 - 07:45 PM

You could also put the code for the menu in an external PHP file which could be called via an include.
0

#4 User is offline   Stringer 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 18-December 08
  • Reputation: 0
  • Experience:Beginner
  • Area of Expertise:Photographer

Posted 18 December 2008 - 07:56 PM

thanks for the help guys

i've never actually used PHP before

is it easy enough to do?

how would I get it to include into the webpage itself?

sorry if i sound really stupid

Thanks
Paul
0

#5 User is offline   pat24 

  • Guru of nothing important!!
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,174
  • Joined: 29-April 08
  • Reputation: 129
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 18 December 2008 - 09:08 PM

View PostStringer, on Dec 18 2008, 19:56, said:

thanks for the help guys

i've never actually used PHP before

is it easy enough to do?

how would I get it to include into the webpage itself?

sorry if i sound really stupid

Thanks
Paul


Take this menu for example

<body>
<div id="wrapper">
<div id="header"></div>
<div id="foxmenucontainer">
	<div id="foxmenu">
		<ul>
			<li><a href="#" title="css menus" class="current"><span>Home</span></a></li>
			<li><a href="#" title="css menus"><span>Conveyor Systems</span></a></li>
			<li><a href="#" title="css menus"><span>Vehicle Loaders</span></a></li>
			<li><a href="#" title="css menus"><span>Storage Systems</span></a></li>
			<li><a href="#" title="css menus"><span>Service/Maintenance</span></a></li>
			<li><a href="#" title="css menus"><span>Contact</span></a></li>
		</ul>
	</div>
	</div>
</div>


I want to use this menu on multiple pages, so I create a php include file, I save the following code from the above as menu.html

<div id="foxmenucontainer">
	<div id="foxmenu">
		<ul>
			<li><a href="#" title="css menus" class="current"><span>Home</span></a></li>
			<li><a href="#" title="css menus"><span>Conveyor Systems</span></a></li>
			<li><a href="#" title="css menus"><span>Vehicle Loaders</span></a></li>
			<li><a href="#" title="css menus"><span>Storage Systems</span></a></li>
			<li><a href="#" title="css menus"><span>Service/Maintenance</span></a></li>
			<li><a href="#" title="css menus"><span>Contact</span></a></li>
		</ul>
	</div>
	</div>


then I use the following code to replace the code I have just saved as menu.html

<?php include("menu.html"); ?>


so your original piece of code would now look like this

<body>
<div id="wrapper">
<div id="header"></div>
<?php include("menu.html"); ?>
</div>


if this code is put on all your pages where the menu will appear, then simply by changing the saved menu.html file you are effectively changing every page with the php include contained in it.

You will have to change all pages containing the code to .php e.g if you have an index.html page with the php include in it you will have to change the page to index.php.

But before you do this make certain your host supports php

Pat
0

#6 User is offline   craftedpixelz 

  • Expert
  • PipPipPipPip
  • Group: Members
  • Posts: 644
  • Joined: 28-June 08
  • Reputation: 5
  • Gender:Male
  • Location:Manchester, UK
  • Experience:Web Guru
  • Area of Expertise:Web Designer

Posted 18 December 2008 - 11:24 PM

Pat has pretty much hit the nail on the head. That's what I was just about to reply saying. Hopefully that should be enough to help you along, but if not come back and we shall try to help as best as possible. :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users