Page 1 of 1

PHP in HTML

Posted: Mon Nov 27, 2006 8:52 pm
by coreyphp
I wanted to put my PHP in my HTML code using the <?php and ?> tags, but the PHP code is very long and has several end (?>) tags in it. Is there a way to wrap the entire php code in one big start and end tags?

Posted: Mon Nov 27, 2006 8:55 pm
by aaronhall
You may be looking for the heredoc syntax

Posted: Mon Nov 27, 2006 8:58 pm
by coreyphp
No, I'm trying to wrap around the php code not within it.

Posted: Mon Nov 27, 2006 9:02 pm
by aaronhall
If I understand what you're saying, you could use the heredoc syntax to output any html that you are printing to the browser without having to escape from php mode (you could also use echo to do this). Also, consider separating your logic and presentation by putting large chunks of HTML into separate files and including those files into the PHP script.