wragen22 Posted June 6, 2007 Share Posted June 6, 2007 I am following along with a "php solutions dynamic web design made easy" book. I am trying to get a php includes file to work with an index.php file. I am doing all of this on my mac as localhost. I have php installed and python running. I am using bbedit to write and edit the files. Any help would be much appreciated. The navigation is simply not showing up in the left hand side, making me think that the php includes is not working properly. The index.php is: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Japan Journey</title> <link href="assets/journey.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> <div id="header"> <h1>Japan Journey </h1> </div> <div id="wrapper"> <?php include('includes/menu.inc.php'); ?> <div id="maincontent"> <h1>A journey through Japan with PHP </h1> <p>Ut enim ad minim veniam, quis nostrud exercitation consectetur adipisicing elit. Velit esse cillum dolore ullamco laboris nisi in reprehenderit in voluptate. </p> <div id="pictureWrapper"><img src="images/basin.jpg" alt="Water basin at Ryoanji temple" width="350" height="237" class="picBorder" /></div> <p>Eu fugiat nulla pariatur. Ut labore et dolore magna aliqua. Cupidatat non proident, quis nostrud exercitation ut enim ad minim veniam.</p> <p> Lorem ipsum dolor sit amet, ut enim ad minim veniam, consectetur adipisicing elit. Duis aute irure dolor ut aliquip ex ea commodo consequat.</p> <p>Sed do eiusmod tempor incididunt velit esse cillum dolore ullamco laboris nisi.</p> </div> <div id="footer"> <p>© 2006 David Powers</p> </div> </div> </body> </html> and the menu.inc.php in the includes folder is: <ul id="nav"> <li><a href="index.php" id="here">Home</a></li> <li><a href="journal.php">Journal</a></li> <li><a href="gallery.php">Gallery</a></li> <li><a href="contact.php">Contact</a></li> </ul> Quote Link to comment https://forums.phpfreaks.com/topic/54398-php-includes-not-working/ Share on other sites More sharing options...
mmarif4u Posted June 6, 2007 Share Posted June 6, 2007 change this: <ul id="nav"> <li><a href="index.php" id="here">Home[/url]</li> <li><a href="journal.php">Journal[/url]</li> <li><a href="gallery.php">Gallery[/url]</li> <li><a href="contact.php">Contact[/url]</li> </ul> To this: <ul id="nav"> <li><a href="index.php" id="here">Home</a></li> <li><a href="journal.php">Journal</a></li> <li><a href="gallery.php">Gallery</a></li> <li><a href="contact.php">Contact</a></li> </ul> Now what is the error showed there by php. Quote Link to comment https://forums.phpfreaks.com/topic/54398-php-includes-not-working/#findComment-268987 Share on other sites More sharing options...
Lumio Posted June 6, 2007 Share Posted June 6, 2007 @mmarif4u he used a quote box and there the <a> tags get replaced. View your sourcecode and look if there are some errors or something like that. Quote Link to comment https://forums.phpfreaks.com/topic/54398-php-includes-not-working/#findComment-269016 Share on other sites More sharing options...
mmarif4u Posted June 6, 2007 Share Posted June 6, 2007 @Lumio i know that i replace it bcoz once time i get error using these. Quote Link to comment https://forums.phpfreaks.com/topic/54398-php-includes-not-working/#findComment-269018 Share on other sites More sharing options...
wragen22 Posted June 6, 2007 Author Share Posted June 6, 2007 Yes, sorry the /quote is not there in my code. I am not getting any errors...or at least I don't think so. How can I check? This code was mainly written by a tutorial. All I did was cut and paste the ul into a menu.inc.php in an includes folder. After doing this the Ul does not show up when loading the index.php in firefox. Quote Link to comment https://forums.phpfreaks.com/topic/54398-php-includes-not-working/#findComment-269213 Share on other sites More sharing options...
per1os Posted June 6, 2007 Share Posted June 6, 2007 <?php error_reporting(E_ALL); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Japan Journey</title> <link href="assets/journey.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> <div id="header"> <h1>Japan Journey </h1> </div> <div id="wrapper"> <?php include('includes/menu.inc.php'); ?> <div id="maincontent"> <h1>A journey through Japan with PHP </h1> <p>Ut enim ad minim veniam, quis nostrud exercitation consectetur adipisicing elit. Velit esse cillum dolore ullamco laboris nisi in reprehenderit in voluptate. </p> <div id="pictureWrapper"><img src="images/basin.jpg" alt="Water basin at Ryoanji temple" width="350" height="237" class="picBorder" /></div> <p>Eu fugiat nulla pariatur. Ut labore et dolore magna aliqua. Cupidatat non proident, quis nostrud exercitation ut enim ad minim veniam.</p> <p> Lorem ipsum dolor sit amet, ut enim ad minim veniam, consectetur adipisicing elit. Duis aute irure dolor ut aliquip ex ea commodo consequat.</p> <p>Sed do eiusmod tempor incididunt velit esse cillum dolore ullamco laboris nisi.</p> </div> <div id="footer"> <p>© 2006 David Powers</p> </div> </div> </body> </html> Try that and see if you get any error messages. Quote Link to comment https://forums.phpfreaks.com/topic/54398-php-includes-not-working/#findComment-269215 Share on other sites More sharing options...
wragen22 Posted June 6, 2007 Author Share Posted June 6, 2007 I put it in. There were no errors showing up. Quote Link to comment https://forums.phpfreaks.com/topic/54398-php-includes-not-working/#findComment-269405 Share on other sites More sharing options...
per1os Posted June 6, 2007 Share Posted June 6, 2007 Ok try this <?php error_reporting(E_ALL); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Japan Journey</title> <link href="assets/journey.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> <div id="header"> <h1>Japan Journey </h1> </div> <div id="wrapper"> <?php include('includes/menu.inc.php') or DIE("Could not include file"); ?> <div id="maincontent"> <h1>A journey through Japan with PHP </h1> <p>Ut enim ad minim veniam, quis nostrud exercitation consectetur adipisicing elit. Velit esse cillum dolore ullamco laboris nisi in reprehenderit in voluptate. </p> <div id="pictureWrapper"><img src="images/basin.jpg" alt="Water basin at Ryoanji temple" width="350" height="237" class="picBorder" /></div> <p>Eu fugiat nulla pariatur. Ut labore et dolore magna aliqua. Cupidatat non proident, quis nostrud exercitation ut enim ad minim veniam.</p> <p> Lorem ipsum dolor sit amet, ut enim ad minim veniam, consectetur adipisicing elit. Duis aute irure dolor ut aliquip ex ea commodo consequat.</p> <p>Sed do eiusmod tempor incididunt velit esse cillum dolore ullamco laboris nisi.</p> </div> <div id="footer"> <p>© 2006 David Powers</p> </div> </div> </body> </html> Also make sure that relative to the script the menu.inc.php is in the includes DIR. Quote Link to comment https://forums.phpfreaks.com/topic/54398-php-includes-not-working/#findComment-269426 Share on other sites More sharing options...
wragen22 Posted June 6, 2007 Author Share Posted June 6, 2007 it is. Quote Link to comment https://forums.phpfreaks.com/topic/54398-php-includes-not-working/#findComment-269433 Share on other sites More sharing options...
per1os Posted June 6, 2007 Share Posted June 6, 2007 Ok, let's try this then: menu.inc.php <script>alert("We have Lift Off!!!");</script> <ul id="nav"> <li><a href="index.php" id="here">Home</a></li> <li><a href="journal.php">Journal</a></li> <li><a href="gallery.php">Gallery</a></li> <li><a href="contact.php">Contact</a></li> </ul> See if you get the javascript popup. Quote Link to comment https://forums.phpfreaks.com/topic/54398-php-includes-not-working/#findComment-269436 Share on other sites More sharing options...
wragen22 Posted June 6, 2007 Author Share Posted June 6, 2007 Yes, the pop-up worked. Quote Link to comment https://forums.phpfreaks.com/topic/54398-php-includes-not-working/#findComment-269497 Share on other sites More sharing options...
per1os Posted June 6, 2007 Share Posted June 6, 2007 Then the problem is not with PHP, rather your CSS as the file is being included. Have fun diagnosing the CSS...ewwww. Quote Link to comment https://forums.phpfreaks.com/topic/54398-php-includes-not-working/#findComment-269500 Share on other sites More sharing options...
wragen22 Posted June 6, 2007 Author Share Posted June 6, 2007 here is some of the css #nav { position: absolute; top: 140px; left: 60px; width: 90px; } ul#nav { list-style: none; margin: 0; padding: 0; } #nav a { display: block; width: 100px; padding-left: 10px; margin: 3px 0; text-decoration: none; font-family: Geneva, Arial, Helvetica, sans-serif; font-variant: small-caps; font-weight: bold; } #nav a:link, #nav a:visited { border-left: #00425E solid 10px; color: #00425E; } #nav a:hover, #nav a:active { border-left-color: #fff; background-color: #00425E; color: #fff; } Quote Link to comment https://forums.phpfreaks.com/topic/54398-php-includes-not-working/#findComment-269534 Share on other sites More sharing options...
per1os Posted June 6, 2007 Share Posted June 6, 2007 here is some of the css #nav { position: absolute; top: 140px; left: 60px; width: 90px; } ul#nav { list-style: none; margin: 0; padding: 0; } #nav a { display: block; width: 100px; padding-left: 10px; margin: 3px 0; text-decoration: none; font-family: Geneva, Arial, Helvetica, sans-serif; font-variant: small-caps; font-weight: bold; } #nav a:link, #nav a:visited { border-left: #00425E solid 10px; color: #00425E; } #nav a:hover, #nav a:active { border-left-color: #fff; background-color: #00425E; color: #fff; } You won't get much help on the PHP HELP forum, post that over in ther CSS forum, that is where those gurus live. Quote Link to comment https://forums.phpfreaks.com/topic/54398-php-includes-not-working/#findComment-269536 Share on other sites More sharing options...
wragen22 Posted June 6, 2007 Author Share Posted June 6, 2007 Alright, I decided to ditch the tutorial and make an index.php and a menu.inc.php in a folder called includes in the Sites directory on my mac. I used BBedit to make these files. I was still unsuccessful getting the includes to show up. the index.php is: <body> <ul><?php include('includes/menu.inc.php') ?></ul> hello </body> and the menu.inc.php in the "includes" folder is <li><a href="index.php" id="here">Home</a></li> <li><a href="journal.php">Journal</a></li> Shouldn't this work? Quote Link to comment https://forums.phpfreaks.com/topic/54398-php-includes-not-working/#findComment-269583 Share on other sites More sharing options...
per1os Posted June 7, 2007 Share Posted June 7, 2007 View the page source and see if they are showing up. If they are than something on the html side is screwing it up, if they are not than it is php. First narrow it down that way. Quote Link to comment https://forums.phpfreaks.com/topic/54398-php-includes-not-working/#findComment-269725 Share on other sites More sharing options...
mmarif4u Posted June 7, 2007 Share Posted June 7, 2007 Put this at very top of the page like this before include: <?php ini_set('display_errors','1'); error_reporting(E_ALL); include('page.php'); rest of code... ?> It will show u the error either include file is working or not. Quote Link to comment https://forums.phpfreaks.com/topic/54398-php-includes-not-working/#findComment-269730 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.