...

View Full Version : user and guest pages



runnerjp
03-08-2007, 11:57 AM
Parse error: syntax error, unexpected T_IF in /home/runnerse/public_html/index.php on line 10

thats what i keep getting with this code


<?
// File ID: index.php (main page for profile site)


include("require/config.php");
require("require/authmember.php");

$auth=authenticate($login, $password);
include("include/get_config.inc.php");
$content=if($auth[error]) { include("include/index.inc.php"); }
else { include("include/index.log.php"); }
if ($auth[error]) {$menu="include/menu_u.inc.php";} else {$menu="include/menu_v.inc.php";}

include("include/header.inc.php");
include("include/body.inc.php");
//include("include/footer.inc.php");
?>

any idea ppl cheers :D

maghiel
03-08-2007, 12:15 PM
Parse error: syntax error, unexpected T_IF in /home/runnerse/public_html/index.php on line 10

thats what i keep getting with this code


<?
// File ID: index.php (main page for profile site)


include("require/config.php");
require("require/authmember.php");

$auth=authenticate($login, $password);
include("include/get_config.inc.php");
$content=if($auth[error]) { include("include/index.inc.php"); }
else { include("include/index.log.php"); }
if ($auth[error]) {$menu="include/menu_u.inc.php";} else {$menu="include/menu_v.inc.php";}

include("include/header.inc.php");
include("include/body.inc.php");
//include("include/footer.inc.php");
?>

any idea ppl cheers :D

yes,

this part is bull:



$content=if($auth[error]) { include("include/index.inc.php"); }
else { include("include/index.log.php"); }


should be


if($auth[error]) { include("include/index.inc.php"); }
else { include("include/index.log.php"); }


if you want to store the included file in a variable, use output buffering

runnerjp
03-08-2007, 12:18 PM
what do you mean by output buffering... i take it that thats wat till make it so the page appears in the body ??

maghiel
03-08-2007, 01:46 PM
what do you mean by output buffering... i take it that thats wat till make it so the page appears in the body ??

read the manual, http://nl3.php.net/manual/en/function.include.php,

if you include a file it's included, ran as if it was inline with the code. so no need to put in in a var an then output that var or whatever.

output buffering is needed when you dó want to store the included stuff in a var for maybe later outputting. but i don't think you want to do that.

here's something about output buffering:
http://blog.mdijksman.nl/?item=putting-a-template-s-output-in-a-variable

runnerjp
03-08-2007, 01:57 PM
yes i dont think i need that... that the problem im haveing now is that i have used


if (file_exists($content)) {
include($content);
} else {?>

in the body to display the content and before i changed the script i used

$content="include/index.inc.php";
so that the index file would display in the content bit in body


so how would i add $content= to


if($auth[error]) { include("include/index.inc.php"); }
else { include("include/index.log.php"); }

maghiel
03-08-2007, 02:39 PM
yes i dont think i need that... that the problem im haveing now is that i have used


if (file_exists($content)) {
include($content);
} else {?>

in the body to display the content and before i changed the script i used

$content="include/index.inc.php";
so that the index file would display in the content bit in body


so how would i add $content= to


if($auth[error]) { include("include/index.inc.php"); }
else { include("include/index.log.php"); }

wasnt completely right above, sorry, it's almost weekend ;)



if ($auth[error])
{
$content = include('./include/index.inc.php');
}
else
{
$content = include('./include/index.log.php');
}

OR

$content = $auth[error] ? include('./include/index.inc.php') : include('./include/index.log.php');

OR

$includeFile = $auth[error] ? 'index.inc.php' : 'index.log.php';
$content = include('./include' . $includeFile);


or something :P

runnerjp
03-08-2007, 03:04 PM
lol wunderd why i got it worng


thing is i cant seem to get it to work...even with what you gave me... it always appear at top of page with every thing below it



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum