Jump to content

[SOLVED] Echo/Include Problems


Timma

Recommended Posts

Not sure what the problem could be...

 

Parse error: syntax error, unexpected T_INCLUDE, expecting ',' or ';' in *****\index.php on line 8

 

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

echo "
<table width='1024' border='0' cellspacing='0' cellpadding='0'>
  <tr>
    <td width='150'>"
include('includes/nav.php');
"</td>
    <td width='12'> </td>
    <td width='700'>"
if(!$page){
include('pages/main.php');
} else {
if(file_exists('pages/'.$page.'.php')){
include('pages/'.$page.'.php');
} else {
echo('This page does not exist!');
} 
}
"</td>
    <td width='162'> </td>
  </tr>
</table>
";


include('includes/footer.php');
?>

Link to comment
https://forums.phpfreaks.com/topic/61520-solved-echoinclude-problems/
Share on other sites


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

$content = "";

$content .= "<table width='1024' border='0' cellspacing='0' cellpadding='0'><tr><td width='150'>";
$content .= include('includes/nav.php');
$content .= "</td><td width='12'> </td><td width='700'>";
if(!$page){
$content .= include('pages/main.php');
} else {
if(file_exists('pages/'.$page.'.php')){
$content .= include('pages/'.$page.'.php');
} else {
$content .= echo('This page does not exist!');
} 
}
$content .="</td><td width='162'> </td></tr></table>";

print $content;
include('includes/footer.php');
?>

check this out

u can't assign echo to some variable

 

<?php

$page = basename($_SERVER['QUERY_STRING']);

include('includes/header.php');

$content = "";

$content .= "<table width='1024' border='0' cellspacing='0' cellpadding='0'><tr><td width='150'>";

$content .= include('includes/nav.php');

$content .= "</td><td width='12'> </td><td width='700'>";

if(!$page){

$content .= include('pages/main.php');

} else {

if (file_exists('pages/'.$page.'.php')){

$content .= include('pages/'.$page.'.php');

} else {

$content .= 'This page does not exist!';

}

}

$content .="</td><td width='162'> </td></tr></table>";

print $content;

include('includes/footer.php');

?>

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.