Jump to content
Larry Ullman's Book Forums

Recommended Posts

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

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

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

 Share

×
×
  • Create New...