Jump to content

echo problem? :(


aebstract

Recommended Posts

uhm... I don't know how to explain this, but I'll post my code and sample url and see if anyone can help me get the content in to the content div.

[code]<?php
$page = $_GET['page'];

if (isset($page)) {
include ("$page.php");
} else {
include ("home.php");
}


?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Uniquely Yours - Log Furniture</title>
<link href="misc/stylesheet.css" rel="stylesheet" type="text/css" title="default" />
</head>
<body>

<div id="base">
<div id="top"><img src="top.jpg" /></div>
<div id="navhold">
<div id="navigation">
<?php


echo '<ul id="navlist">
<li'.(($page == 'home' || empty($page)) ? ' class="active"' : '').'><a href="index.php">Home</a></li>
<li'.(($page == 'about') ? ' class="active"' : '').'><a href="index.php?page=about">About</a></li>
<li'.(($page == 'gallery') ? ' class="active"' : '').'><a href="index.php?page=gallery">Gallery</a></li>
<li'.(($page == 'contact') ? ' class="active"' : '').'><a href="index.php?page=contact">Contact</a></li>
</ul>';



?>
</div>
</div>
<div id="contentholder">
<div id="content">
<?php
echo "$content";
?>

</div>
</div>
<div id="footer">
<div id="copyright">Copyright &#169; 2006, Uniquely Yours. <br />All rights reserved.</div>
</div>
<div id="spacer"></div>
</div>

</body>
</html>
[/code]


www.carbenco.com/uy/

content should go in to a white box under the nav. it is showing up at top of page?
Link to comment
https://forums.phpfreaks.com/topic/23603-echo-problem/
Share on other sites

If that is the only thing in home.php, you need to enclose it between <?php and ?>

Look at the top of index.php.  With the URL you gave, there is no $_GET param, so it includes home.php.  home.php is just opened and dumped in place.  If you want to put php into an included file, you still need to start your php with <?php and end it with ?>
Link to comment
https://forums.phpfreaks.com/topic/23603-echo-problem/#findComment-107170
Share on other sites

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.