glenn kilpatrick Posted July 9, 2006 Share Posted July 9, 2006 Hi Everyone,I have just done my very first piece of php - an include menu file. To be honest I was shocked to see it never worked. Your help would be much appreciated here.This is the code I used in my index file which can be viewed at www.whitbyseaanglers.co.uk<?php include("menu.php"); ?>This is the code in a file named menu.php on my server in the same directory.<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>New Page 1</title></head><body><ul id="nav"><li><a href="index.htm"> Home</a></li><li>About Us<ul><li><a href="aboutus.htm">Club Details</a></li><li><a href="history.htm">History</a></li></ul></li><li> Club Stats<ul><li><a href="results.htm">Results</a></li><li><a href="positions.htm">Positions</a></li><li><a href="05-06individualcatches.htm">Angler Stats</a></li></ul></li><li> Galleries<ul><li><a href="gallery.htm">Gallery</a></li><li><a href="pictures.htm">NE Gallery</a></li><li><a href="friendsgallery.htm">Friends</a></li></ul></li><li><a href="archives.htm">Archives</a></li><li>Site Map</li><li><a href="calendar.htm">Calendar</a></li><li> Contact<ul><li><a href="mailto:whitbyseaanglers@ntlworld.com?subject=Fishing Club">Email</a></li><li><a href="guestbook">Guestbook</a></li><li><a href="http://wsaa.proboards106.com/index.cgi">Message Board</a></li></ul></li><li>Useful Info<ul style="position: absolute; left: 0px; top: 19px"><li><a href="http://www.pol.ac.uk/ntslf/tides/?port=0174">Tides</a></li><li><a href="links.htm">Links</a></li><li><a href="sitemap.htm">Site Map</a></li><li><a href="sizelimits.htm">Size Limits</a></li><li><a href="bait.htm">Bait</a></li><li><a href="peelers.htm">Peelers</a></li><li><a href="http://homepage.ntlworld.com/lisa.broadley/fishingatwhitby/index">Fishing at Whitby</a></li><li><a href="http://whitbyseaanglers.blogspot.com/">GlennBlog</a></li></ul></li></ul></body></html> ??? ??? ??? ??? ??? ???Would someone please let me know where I am going wrong. Kind regards - Glenn Quote Link to comment https://forums.phpfreaks.com/topic/14084-my-very-first-php-guess-what-it-doesnt-work/ Share on other sites More sharing options...
redarrow Posted July 9, 2006 Share Posted July 9, 2006 Dont understand your problam if got one. Quote Link to comment https://forums.phpfreaks.com/topic/14084-my-very-first-php-guess-what-it-doesnt-work/#findComment-55062 Share on other sites More sharing options...
glenn kilpatrick Posted July 9, 2006 Author Share Posted July 9, 2006 Hi,The menu doesnt appear.There should be a menu just below the header image. Have a look at www.whitbyseaanglers.co.uk The menu hasnt been included. Quote Link to comment https://forums.phpfreaks.com/topic/14084-my-very-first-php-guess-what-it-doesnt-work/#findComment-55065 Share on other sites More sharing options...
digitalgod Posted July 9, 2006 Share Posted July 9, 2006 try renaming your index.htm to index.php Quote Link to comment https://forums.phpfreaks.com/topic/14084-my-very-first-php-guess-what-it-doesnt-work/#findComment-55066 Share on other sites More sharing options...
Gummie Posted July 9, 2006 Share Posted July 9, 2006 Hi All,Glen, can you be more specific please. I've put together your files and they appear to work, though your menu system still requires a lot of work.One point though; when you include a file, remove all the extraneous HTML tags. For instance, after your page has been executed on the server, it shouldn't show multiple BODY or HEAD tags.GummiePSPlease also mention the server/software/setup that you have for future reference i.e. phpMyAdmin or EasyPHP, etc, etcThanks Quote Link to comment https://forums.phpfreaks.com/topic/14084-my-very-first-php-guess-what-it-doesnt-work/#findComment-55225 Share on other sites More sharing options...
robos99 Posted July 9, 2006 Share Posted July 9, 2006 Insert this little bit of code before you include your menu...[code]error_reporting(E_ALL);[/code]that should issue a notice if your included file isn't being included. If you read the PHP manual you'd see that the big difference between include and require is that include will fail and issue a notice, whereas require will fail and issue a fatal error and this stopping execution of the script. You wouldn't want your page to load without the menu would you? So you should be using require.....and it just seems best practice to use require_once, since you wouldn't want to include that menu more than one time in the script would you?It's best practice to set error_reporting to E_ALL to catch all notices and such when you're debugging your system. This really comes in handy with the more complex scripts and helps you catch things like undefined variables which could be the reason why a script doesn't run right.Your menu.php file appears to be just straight html. Why not just rename it with an html extension instead of php? Is there some reason you want this to be parsed by php? Quote Link to comment https://forums.phpfreaks.com/topic/14084-my-very-first-php-guess-what-it-doesnt-work/#findComment-55244 Share on other sites More sharing options...
Daniel0 Posted July 9, 2006 Share Posted July 9, 2006 It works for me... Quote Link to comment https://forums.phpfreaks.com/topic/14084-my-very-first-php-guess-what-it-doesnt-work/#findComment-55247 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.