dwiggin Posted February 19, 2013 Share Posted February 19, 2013 I am having a problem with Chapter 3 index.php. I can get the html files to work independantly, but when I try to include them in the index.php file I get an can't find error. Help Link to comment Share on other sites More sharing options...
HartleySan Posted February 19, 2013 Share Posted February 19, 2013 Likely it's because the include paths are incorrect. Could you please post the relevant code and info about your folder structure? Thanks. Link to comment Share on other sites More sharing options...
dwiggin Posted February 19, 2013 Author Share Posted February 19, 2013 Using XAMPP all the files are in the htdocs file. The code for index.php: <?php # Script 3.4 - index.php$page_title = 'Welcome to this site!';include ('includes/header.inc.html'); ?> <h1>Content Header</h1> <p>This is where the page-specific content goes. This section, and the conresponding header, will change from one page to the next.</p> <p>Volutpat at various sed sollicitudin et, arcu. Vivamus viverra. Nullam turpis. Vestibullum sed etiam. Lorem, ipsum sit amet dolore. Nulla faclilisi. Sed tortor. Anean felis. Quisque eros. Cras lobortis commond metus. Vestibilum vel purus. I egat odio in sapien adipiscing blandit. Quiisque augue tortor, facilisis sit amet, aliquam, suscipit vitae, cursus sed, arcu lorem ipsum dolor sit amet.</p> <?php include ('includes/footer.inc.html'); ?> The message indicates it cannot find header.html or footer.html. I have the same problem with the calculator program. Don Link to comment Share on other sites More sharing options...
HartleySan Posted February 19, 2013 Share Posted February 19, 2013 Most likely it's because your include paths contain the "includes" folder. If all your files are sitting in the htdocs folder, then either remove the "includes/" part from your include paths, or create an "includes" folder within the htdocs folder and place the header and footer files in that folder. It should work then. The main thing is the relative paths between the script that you're executing and the scripts that you're including must reflect exactly what you write within the parentheses of the include function. Link to comment Share on other sites More sharing options...
dwiggin Posted February 20, 2013 Author Share Posted February 20, 2013 The include directory worked. I retrospect it makes sense since the include statement is a path statement. The text hints and that but does not describe it to well. Taking out the include alltogether did not seem to work, but I want to work with a little more. Thanks Don Link to comment Share on other sites More sharing options...
HartleySan Posted February 20, 2013 Share Posted February 20, 2013 The PHP error messages can often be quite cryptic until you get used to them. It's usually a good idea to Google the message text in order to figure out what it's actually saying. Link to comment Share on other sites More sharing options...
Recommended Posts