Jump to content

Archived

This topic is now archived and is closed to further replies.

skanza

PHP help

Recommended Posts

I have no idea what is wrong, i am trying to include a file for a menu

name

 

menu.inc

 

i use this script

 

 

CODE

<?php include(menu.inc& #41;; ?>

 

 

 

and all i get is

 

 

CODE

Warning: main(menuinc) : failed to open stream: No such file or directory in /customers/swift-crea tions.com/swift-creat ions.com/httpd.www/cl an/index.php on line 38

 

Warning: main(): Failed opening 'menuinc' for inclusion (include_path= 9;.:/usr/lib/php& #39;) in /customers/swift-crea tions.com/swift-creat ions.com/httpd.www/cl an/index.php on line 38

 

 

 

Any help please??

 

An Include Example

Say we wanted to create a common menu file that all our pages will use. For easy reference, files that are to be included usually are named with a ".inc" extension. Since we want to create a common menu, let us save it as "menu.inc".

 

menu.inc Code:
<html> <body>
<a href="index.php">Home</a> - 
<a href="about.php">About Us</a> - 
<a href="links.php">Links</a> - 
<a href="contact.php">Contact Us</a> <br /> 

 

Save the above file as "menu.inc". Now create a new file, "index.php" in the same directory as "menu.inc". Here we will take advantage of the include function to add our common menu.

 

i got this from

http://www.tizag.com/phpT/include.php

 

I want a menu that i can link to other pages on my site, but i want to have only one file that i need to edit, so i dont need to edit everypage, when i add a new page to the site. I Also want to have it so i can instead of having many pages, just have includes on the page.

 

Help me please

 

Thanks

Share this post


Link to post
Share on other sites

<?php

include("filename.inc"); // or filename.php

?>

That's all there is to it. In the example above, filename.inc must be in the same directory as the script that includes it of course.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.