-4

I am making a website using HTML. I am not familiar with PHP. I need the navigation and header part to be in a single place. i.e., Once I change the menus in one place it should reflect in all other pages. Kindly help me on this.

Thanks in Advance.

Nico O
  • 13,762
  • 9
  • 54
  • 69
Mohammed Hussain
  • 151
  • 1
  • 2
  • 8
  • possible duplicate of [What are the new frames?](http://stackoverflow.com/questions/9466265/what-are-the-new-frames) – Quentin Apr 30 '14 at 10:07
  • 1
    kindly google `PHP Beginner Tutorial` yourself. Hint: `require` is the php command you are seraching for to include a file. – Andresch Serj Apr 30 '14 at 10:07
  • It's a legit question for someone who's only wish is to divide his HTML structure to files, you dont really need to know PHP to do that. – fadeys.work Aug 31 '14 at 11:00

1 Answers1

0

You could use include or require to add your Menu-Html file in every page you wish. you could add something like this:

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

wherever your menu should appear in your HTML, having a menu.html file of course. and you'll need an apache server or any other that can 'read' your php files.

include php documentations

require php documentations

fadeys.work
  • 499
  • 4
  • 13
  • Thanks. Which one will work on old browsers?. Includes or require? – Mohammed Hussain Apr 30 '14 at 10:22
  • php has no dependencies on browsers, so either one will do. you should read what's php is all about to better understand what you are about to do. – fadeys.work Apr 30 '14 at 10:23
  • Thanks again. I got your point. A final doubt, as you said, if I save my menu as menu.html and include it on index.php, will it work? or do I need to save menu.html as menu.php? – Mohammed Hussain Apr 30 '14 at 10:26
  • you could include either a php or an html file. just make sure you are running apache or something similar that could handle php files. – fadeys.work Apr 30 '14 at 10:30