parse error on include function

A

Anonymous

Guest
I recently started learning php and have been using it to create this website : Link

I tried making dynamic links using the following code:

<?php
$main="ae.php";
$content=$page.".php";
if(!$page){
include($main);
}elseif (file_exists($content)){
include($content);
}
else include("404.php");
?>

for some reason it didnt work. I also tried to make it simpler with something like
<? include($page);?> and got this error message:

Warning: Failed opening '' for inclusion (include_path='.;D:/phpdev/php/includes;D:/phpdev/php/class') in d:\phpdev\www\public\grunge_alpha\body.php on line 54

as for my system, i'm running winXP
php version 4.2.3

I installed it using phpdev at http://www.firepages.com.au/

any thoughts ?
 
Can't really tell without looking at the code more precisely, but for the main page, why not just write
Code:
<? include 'ae.php'; ?>
 
Your problem is that $page isn't getting set anywhere. If you're trying to get it from the url (e.g. index.php?page=main), then use $_GET['page'].
 
thanks, i managed to fix it :)

i added $page=$_REQUEST['page']
 
Back
Top