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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.