PHP in HTML

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
coreyphp
Forum Newbie
Posts: 2
Joined: Mon Nov 27, 2006 8:51 pm

PHP in HTML

Post 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?
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

You may be looking for the heredoc syntax
coreyphp
Forum Newbie
Posts: 2
Joined: Mon Nov 27, 2006 8:51 pm

Post by coreyphp »

No, I'm trying to wrap around the php code not within it.
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post 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.
Post Reply