Current location: Hot Scripts Forums » General Web Coding » HTML/XHTML/XML » How to make global menu?


How to make global menu?

Reply
  #1 (permalink)  
Old 05-21-09, 08:39 AM
bugzy bugzy is offline
Newbie Coder
 
Join Date: Mar 2009
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
How to make global menu?

Hello I'm new in web designing and I have big problem with my menu. I have a website that has 50+ files, but everytime I will modify my menu I need to it manually.

Is there anyway to make my menu global so that I don't need to do it manually on every page?


Thanks
Reply With Quote
  #2 (permalink)  
Old 05-21-09, 06:14 PM
mdhall's Avatar
mdhall mdhall is offline
Aspiring Coder
 
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
Place your menu into it's own file, then import it into each page. Very easy to do with php.
Reply With Quote
  #3 (permalink)  
Old 05-22-09, 08:18 AM
therocket954's Avatar
therocket954 therocket954 is offline
Community Liaison
 
Join Date: Jul 2007
Location: Michigan, USA
Posts: 334
Thanks: 2
Thanked 8 Times in 8 Posts
Quote:
Originally Posted by mdhall View Post
Place your menu into it's own file, then import it into each page. Very easy to do with php.
Exactly as the above stated would be perfect... Just to elaborate a little more with an example:

Save the below code as "menu.php"
PHP Code:

// This is my menu

<a href="index.php">home</a> <a href="page2.php">Page 2</a> <a href="page3.php">Page 3</a
Now, on your actual web page files, call and (include) your menu.
HTML Code:
//This is my homepage
<html>
<body>
<?php include('menu.php'); ?>
<hr />
<h1>This is my homepage</h1>
<p>This is my body text</p>
</body>
</html>
The only requirement to be able to do the above, is that your web server has to support PHP and your pages have to have the .php extension. (not .htm or .html).... there is a way around that... but that's a different thread

Hope this helps!
__________________
--Eric Allison
Twitter: http://www.twitter.com/Eric_Allison
Reply With Quote
  #4 (permalink)  
Old 05-22-09, 10:06 AM
bugzy bugzy is offline
Newbie Coder
 
Join Date: Mar 2009
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks man! working now!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Superfish jquery menu problems with modification transcend2005 CSS 2 03-25-09 01:30 AM
css problem with the scroll bar crazy.works CSS 0 11-04-08 05:34 PM
Xml / Dom / Css Mark_SC.SE JavaScript 0 06-29-05 08:05 AM
Redirection back to a page from form submit DAL Perl 11 03-21-05 02:45 PM
PHP Error Fairnie PHP 8 06-26-04 07:15 AM


All times are GMT -5. The time now is 09:06 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.