Jump to content

[SOLVED] PHP Include variables not displaying


zenigame

Recommended Posts

Hello! I'm a new too php and have been trying to make a template solution for a website I'm working on.

I followed a tutorial, http://www.alistapart.com/stories/phpcms/ at alistapart and am developing locally with mamp on osx.

 

I receive these errors:

Notice: Undefined variable: page in /Applications/MAMP/htdocs/asb/template.php on line 19

 

Warning: include(.html) [function.include]: failed to open stream: No such file or directory in /Applications/MAMP/htdocs/asb/template.php on line 19

 

Warning: include() [function.include]: Failed opening '.html' for inclusion (include_path='.:/Applications/MAMP/bin/php5/lib/php') in /Applications/MAMP/htdocs/asb/template.php on line 19

 

------------------------

 

And my line 19 is:

<?php include ("$page.html"); ?>

 

I enter this as my url:

http://localhost:8888/asb/template.php?page=home

 

Home doesn't display through the template. Any idea what's wrong?

 


do you have $page  set from $_GET['page'] ??

 

try this:

 

<?php

 

include_once ( "$_GET


.html" );

 

?>

 

If that works then your $page variable doesnt contain the correct  data which is actually indicated by this error: Warning: include(NO_FILE_NAME_HERE.html) [function.include]: failed to open stream: No such file or directory in /Applications/MAMP/htdocs/asb/template.php on line 19

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.