Jump to content


Photo

echo problem? :(


  • Please log in to reply
4 replies to this topic

#1 aebstract

aebstract
  • Members
  • PipPipPip
  • Advanced Member
  • 1,105 posts

Posted 10 October 2006 - 09:50 PM

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.

<?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>


www.carbenco.com/uy/

content should go in to a white box under the nav. it is showing up at top of page?

There is an area of the mind that could be called unsane, beyond sanity, and yet
not insane. Think of a circle with a fine split in it. At one end there's
insanity. You go around the circle to sanity, and on the other end of the
circle, close to insanity, but not insanity, is unsanity.


#2 roopurt18

roopurt18
  • Staff Alumni
  • Advanced Member
  • 3,749 posts
  • LocationCalifornia, southern

Posted 10 October 2006 - 09:56 PM

What is the name of the file you posted the code for?

What is inside home.php?
PHP Forms : Part I | Part II

JavaScript: Singleton

http://www.rbredlau.com

#3 aebstract

aebstract
  • Members
  • PipPipPip
  • Advanced Member
  • 1,105 posts

Posted 10 October 2006 - 09:58 PM

the file i posted is index.php, home.php is

$content = "home page";

There is an area of the mind that could be called unsane, beyond sanity, and yet
not insane. Think of a circle with a fine split in it. At one end there's
insanity. You go around the circle to sanity, and on the other end of the
circle, close to insanity, but not insanity, is unsanity.


#4 roopurt18

roopurt18
  • Staff Alumni
  • Advanced Member
  • 3,749 posts
  • LocationCalifornia, southern

Posted 10 October 2006 - 10:02 PM

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 ?>
PHP Forms : Part I | Part II

JavaScript: Singleton

http://www.rbredlau.com

#5 aebstract

aebstract
  • Members
  • PipPipPip
  • Advanced Member
  • 1,105 posts

Posted 10 October 2006 - 10:04 PM

thanks. ive had a long day and a headache, stupid error :)

There is an area of the mind that could be called unsane, beyond sanity, and yet
not insane. Think of a circle with a fine split in it. At one end there's
insanity. You go around the circle to sanity, and on the other end of the
circle, close to insanity, but not insanity, is unsanity.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users