View Full Version : Loading part of a page?
09-11-2003, 03:14 AM
First let me say I don't currently know any php. I had read that it is possible to 'load' part of a page, such as a menu system, across any number of pages using a php script.
Is this correct?
09-11-2003, 03:22 AM
Yes, this is correct. And quite easy to do so. All you need is
and the content of file.html gets inserted at exactly where you position that statement in your document.
09-11-2003, 03:31 AM
This sounds very cool. I'm about to save my menu as it's own html document, and try this out.
Should I strip any of the tags from it? How about the DTD?
09-11-2003, 03:46 AM
Only include the parts of the page you actually need. Think of it like pasting text at a specific location of the file. If the menu code is just some HTML elements, and should come right after opening body tag, you don't need to put header, DTD or similar information into your include file.
Just try it out; it's really simple to understand the concept.
09-11-2003, 04:16 AM
for whatever reason it is not working. The rest of the page looks fine, then menu is missing. I tried the snip you posted:
I tried saving the page with the script as a .php file, I assume this is correct. It does not work either way, but when saved as .php and I view the source, the script itself does not appear.
09-11-2003, 04:39 AM
I had to save both the file to be included as well as the file with the script as .php files.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.