foochuck Posted June 25, 2009 Share Posted June 25, 2009 I'd like to echo a huge chunk of html on my page using PHP...is there a way to echo html rather than using the echo function? FOO Quote Link to comment Share on other sites More sharing options...
phant0m Posted June 25, 2009 Share Posted June 25, 2009 ?> html <?php Quote Link to comment Share on other sites More sharing options...
foochuck Posted June 25, 2009 Author Share Posted June 25, 2009 I'm sorry I didn't explain to well...I'm using an if statement.... <?php if (a == b) { echo 'huge chunk of html goes here'; } Quote Link to comment Share on other sites More sharing options...
947740 Posted June 25, 2009 Share Posted June 25, 2009 <?php if (a == b) { ?> HTML <?php } ?> OR <?php if (a == b) { echo <<<CONTENT HTML HTML HTML CONTENT; } ?> Quote Link to comment Share on other sites More sharing options...
foochuck Posted June 25, 2009 Author Share Posted June 25, 2009 Thanks 947740 Quote Link to comment Share on other sites More sharing options...
947740 Posted June 25, 2009 Share Posted June 25, 2009 No problem. Quote Link to comment Share on other sites More sharing options...
phant0m Posted June 25, 2009 Share Posted June 25, 2009 For the 2nd possibility posted by 947740, have a look here: http://ch.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc Quote Link to comment Share on other sites More sharing options...
StefanRSA Posted June 25, 2009 Share Posted June 25, 2009 How about putting the huge bunch of HTML in another php file and just use include? It was what I would have done? Or do I miss the point? Quote Link to comment Share on other sites More sharing options...
WolfRage Posted June 25, 2009 Share Posted June 25, 2009 All of the methods will work, it really comes down to what his intentions are and what will be the most efficient for him. Quote Link to comment Share on other sites More sharing options...
947740 Posted June 25, 2009 Share Posted June 25, 2009 How about putting the huge bunch of HTML in another php file and just use include? It was what I would have done? Or do I miss the point? So you don't know what you would have done? Maybe he doesn't know how to includ files. Kind of hard to tell when he doesn't give us much info. Quote Link to comment Share on other sites More sharing options...
foochuck Posted June 25, 2009 Author Share Posted June 25, 2009 This method <?php if (a == b) { ?> HTML <?php } ?> will work the best for me...and yes I know how to do includes. Thanks everyone. Quote Link to comment Share on other sites More sharing options...
947740 Posted June 25, 2009 Share Posted June 25, 2009 ...and yes I know how to do includes. I hope you didn't take that the wrong way. I wasn't trying to insinuate that you were stupid or something, I just didn't know how much you have done PHP. Quote Link to comment Share on other sites More sharing options...
foochuck Posted June 25, 2009 Author Share Posted June 25, 2009 It's all good man It's my fault...I try to explain what I'm looking for and end up leaving out some of the most important stuff. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.