Help - Search - Members - Calendar
Full Version: [resolved] Error issure with dynamic includes tutorial
Codegrrl.com Forums > Script Help > Tutorial Help
GarnetPrincess
First, I am very sorry if this issue was addressed before. I searched the forums for other topics involving this but there were none that I saw with the exact same issue.

I decided I was going to use the tutorial for my website here. I made the "pages" folder as the tutorial said and I copied the code into index.php directly from the tutorial as follows:

CODE
<?php $page = basename($_SERVER['QUERY_STRING']);
include(’header.php’);

if(!$page){
include(’pages/main.php’);
} else {
if(file_exists(’pages/’.$page.’.php’)){
       include(’pages/’.$page.’.php’);
} else {
       echo(’This page does not exist!’);
}
}

include(’footer.php’);
?>


However, when I uploaded the files, the index page didn't load and instead gave the following error:
Parse error: syntax error, unexpected T_STRING in /home/garnetjb/public_html/rouge/index.php on line 10

I have only worked with basic includes up to this point and I don't know a lot about PHP, so I'm not sure how to fix this or what the error means. Any help would be greatly appreciated. smile.gif
Amelie
This is because WordPress (the software that powers CodeGrrl) does strange things to the quotes. They are meant to look like this: ' And not like this: ’

Replace all instances of ’ with ' and it should work.
GarnetPrincess
It's amazing how something small like that can completely mess up a code. I changed it and it works now. Thank you for your help.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.