skanza Posted November 26, 2004 Share Posted November 26, 2004 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 Link to comment https://forums.phpfreaks.com/topic/2066-php-help/ Share on other sites More sharing options...
AndyB Posted November 26, 2004 Share Posted November 26, 2004 <?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. Link to comment https://forums.phpfreaks.com/topic/2066-php-help/#findComment-6752 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.