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

How can I use sessions in PHP?

Help : how to automatically upload files every 5 minutes ? Hi , Can anybody help me with this php code : I want to read the file names from a folder ( word document files or media files with extentions) and enter the url of the files in mysql d

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

How to run a php script on different browsers?

How do I get my chat script to include the contents of the msg file in real time instead of only when the page is refreshed?



Custom Search