Jump to content


PHP help

  • Please log in to reply
1 reply to this topic

#1 skanza

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 26 November 2004 - 12:27 AM

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


i use this script

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

and all i get is

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

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


#2 AndyB

  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 26 November 2004 - 02:17 AM

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.
Legend has it that reading the manual never killed anyone.
My site

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users