PHP Questions Home | Register | Login
Categories
Arrays
Files
Forms
Creating PDFs
PHP Errors
Functions
Images
MySQL
Numbers
Others
Strings
Website
Unanswered

PHP Forums
Forums Index
MySQL Forum
PHP Forum
Flash/Actionscript
Javascript
Web design

More PHP
PHP Functions
Top Questions
Ask a Question
PHP Interview Questions
PHP Jobs
Ecommerce
IT Questions
Business Websites

Sponsors

sponsor ad
My Salary
PHP Developer Salary
Advertise Here

How do I keep my site menu in one file?


One of the best things about PHP is that you need to know very, very little about it to have it revolutionise how you manage your site.

If you have a site of more than a couple of pages, then PHP is your friend.

Infact, the include command we are about to meet is priceless on a large scale site and stops you needing to update a menu across many pages at once.

Here's how it works. You put the content you want to appear on all your pages in a file. So for instance the header content and the start of the body div. You then just do the below to include it on a page:

<?php
include("menu.html");//file containing your template code
?>

... then enter the rest of your content here.

Then just paste this at the top of each page you want your template to appear on, and away you go.

Often sites will have a header and footer include file.

Suddenly your website just got a little easier to manage and update!



Comment on this Question and Answer >>>

ASK A QUESTION

More website PHP Questions

Hello - I am writing a PHP program to control an external camera connected to the USB port. For example I issue commands such as 'up', 'down', etc via an external program that I call using exec("cameracontrol.exe"). I would like to store

What is this form of code for a website? http://www.virginamerica.com/va/home.do the drop down menu's. whats the name for that. im trying to incorporate it into my design, but dont no the name for it.

how to get gmail inboxmessages in php using username and password

How can I find out where a site visitor comes from?

I have a main WEB page that will be sereved. This page has text data on it that will come from a file(iframe). The data in the file will be changed when other applications make requests to the apache server to server data from a database. When this hap



Custom Search