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
Page 1 of 1
CSS Help
#2
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.
ie.
<head> <LINK REL=StyleSheet HREF="style.css" TITLE="main css"> <LINK REL=StyleSheet HREF="menu.css" TITLE="menu css"> </head>
#3
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.
#4
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
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
#5
Posted 18 December 2008 - 09:08 PM
Stringer, 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
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
#6
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.
Share this topic:
Page 1 of 1
Help















