Jump to content


PHP and html

  • Please log in to reply
4 replies to this topic

#1 mousey

  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 21 August 2006 - 02:55 PM

Hi, first time here so excuse me if this is in the wrong place!
Im just learning php and am havin a problem with my site.  I have a layout.php file that contains my layout code and then i have a few pages which call on this file for their layouts.
Im not sure how to explain my problem so again excuse me if it doesnt make any sense!
On my layout.php page, i have used the echo "(then the html code for my layout in here) to get the layout i want.
I've then interupted the echo function using the followng code:
(imagine this is part of my layout code)";include ("menu.php");"(then the rest of my layout code goes here.

The problem im having is that it doesnt seem to be reading the html code after i interrupt the php echo function.
I know this probably doesnt make any sense, but i cant think of a better way to describe my problem! If anyone could offer any help id greatly appreciate it!!
??? ??? ???

#2 SharkBait

  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 21 August 2006 - 03:00 PM

So you have it look like this?

<h3> My header</h3>
<br />
<p>This is some text</p>

<?php include ("menu.php");?>

<p>Now some more code here</p>

Or if not, can you post what you have ?

#3 bobleny

  • Members
  • PipPipPip
  • Advanced Member
  • 429 posts

Posted 21 August 2006 - 03:03 PM

If I read that right, your problem is this:
<?php echo "html"; include("menu.php"); "html"; ?>

The issue:
Once you close the echo you have to reopen it:
<?php echo "html"; include("menu.php"); echo "html"; ?>

You also might try this:
<?php echo "html" . include('menu.php') . "html"; ?>

Basically the dot says there is now some php that needs to be executed before it is echoed, then the closing dot says to stop executing.
-- www.firemelt.net --
First do me a favor and read this: JavaScript is NOT Java - Then read this: www.php.net - When your done with that, read this Topic
After that, floors open. I and anyone else will be MORE than happy to answer YOUR query! [Topic Solved]
Cheer up, the worst has yet to come...

#4 mousey

  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 21 August 2006 - 03:14 PM

Thank you both for uber-quick responses!!
The problem was that i wasn't re-opening the echo command! Working great now!
Thanks guys!

#5 mousey

  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 21 August 2006 - 03:37 PM

Hello me again!
Just one more thing, I wanted to check that im doing this right and that on my layout page i have ";echo$content;" as the contents of one of my cells and that on each page of my site having $content="html code for the content of the cells"??
Thanks guys!

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users