As you probably know, you can output PHP inside of html like so.
But what about big scripts where you'll have to continuously open PHP in different areas? This could make a mess, so lets echo out HTML INSIDE of php!PHP Code:
<html>
<title> Html and php! </title>
<body>
<?php
$Blah = true ? "blah is true" : "blah is false" ;
?>
</body>
<?php
include ("footer.php");
?>
</html>
<?php
May not look like a huge difference here, but trust me, in the long run, it will make a big difference!PHP Code:
echo' <html>
<title> Html and php! </title>
<body>';
$Blah = true ? "blah is true" : "blah is false" ;
include ("footer.php");
echo'</body></html>';
?>
Results 1 to 5 of 5
- 16 Dec. 2010 06:37pm #1
Output html inside of PHP makes life easier!
Last edited by HTML; 17 Dec. 2010 at 01:29am.
- 16 Dec. 2010 09:10pm #2
Error: Title Not Found
- Age
- 29
- Join Date
- Dec. 2009
- Location
- Hell
- Posts
- 2,248
- Reputation
- 248
- LCash
- 10.49
I thought this is how you're supposed to do it...
- 16 Dec. 2010 10:35pm #3
- 17 Dec. 2010 12:16am #4
BTW this code is not working.
original:
Code:<?php echo' <html> <title> Html and php! </title> <body>'; $Blah = true ? "blah is true" : "blah is false" ; echo'</body>'; include ("footer.php"); </html> ?>
Code:<?php echo' <html> <title> Html and php! </title> <body>'; $Blah = true ? "blah is true" : "blah is false" ; include ("footer.php"); echo'</body></html>'; ?>
Also, nothing is ever done with the variable Blah. Its just set, never used or echoed.
- 17 Dec. 2010 01:30am #5
Good catch I didn't see I missed the last tag.