seany123 Posted April 18, 2009 Share Posted April 18, 2009 okay ive never echo's this type of code before so im gonna need a quick hand if possible.. i want it so <?php if($player->rm <= 0){ and then i want it to echo this.... <div id="left_c"><div class="g_content"><h3> Become A Respected Mobster</h3><div class="g_text"> <table width='100%'> <tr> <td align='left' width='58%'> You're not a Respected Mobster yet! Why not?<br /><br /> You're missing out!<br /><br /> <a style='font-size: 18px;' href='http://g.com/elite.php'>Upgrade Now!<br />Starting From $3.00!</a> </td> <td width='42%'> <li>Energy Regenerates <b><u>Twice</u></b> As Quick</li> <li>Bank Interest is <b><u>DOUBLED</u></b>!</li> <li>Yellow Name</li> <li>Respected Mobster Status</li> <li><b><u>Cash Bonus</u></b> on Purchase</li> <li><b><u>Points Bonus</u></b> on Purchase</li> <li>Access to <b><u>RM Only</u></b> Cities</li> <li><b><u>Larger</u></b> Inventory Size</li> </td> </tr> </table></div></div> Quote Link to comment https://forums.phpfreaks.com/topic/154652-solved-help-echoing-some-code/ Share on other sites More sharing options...
premiso Posted April 18, 2009 Share Posted April 18, 2009 echo <<<OUTPUT <div id="left_c"><div class="g_content"><h3> Become A Respected Mobster</h3><div class="g_text"> <table width='100%'> <tr> <td align='left' width='58%'> You're not a Respected Mobster yet! Why not?<br /><br /> You're missing out!<br /><br /> <a style='font-size: 18px;' href='http://game2.mafiadeath.com/elite.php'>Upgrade Now!<br />Starting From $3.00!</a> </td> <td width='42%'> <li>Energy Regenerates <b><u>Twice</u></b> As Quick</li> <li>Bank Interest is <b><u>DOUBLED</u></b>!</li> <li>Yellow Name</li> <li>Respected Mobster Status</li> <li><b><u>Cash Bonus</u></b> on Purchase</li> <li><b><u>Points Bonus</u></b> on Purchase</li> <li>Access to <b><u>RM Only</u></b> Cities</li> <li><b><u>Larger</u></b> Inventory Size</li> </td> </tr> </table></div></div> OUTPUT; Would be one way, you could also close the php tags ?> then after the output reopen it and continue processing. If you want to escape quotes you could echo it out like a string. The syntax I shown is called HEREDOC. Quote Link to comment https://forums.phpfreaks.com/topic/154652-solved-help-echoing-some-code/#findComment-813241 Share on other sites More sharing options...
seany123 Posted April 18, 2009 Author Share Posted April 18, 2009 i usually use php tags then echo and quote all lines... but im a little stuck with the <div> Quote Link to comment https://forums.phpfreaks.com/topic/154652-solved-help-echoing-some-code/#findComment-813243 Share on other sites More sharing options...
soak Posted April 18, 2009 Share Posted April 18, 2009 I'm not sure what you're saying, premiso's answer gives you an example of how to do it and is very comprehensive. Quote Link to comment https://forums.phpfreaks.com/topic/154652-solved-help-echoing-some-code/#findComment-813248 Share on other sites More sharing options...
seany123 Posted April 18, 2009 Author Share Posted April 18, 2009 so if i did this it would work? <?php if($player->rm <= 0) { echo <<<OUTPUT <div id="left_c"><div class="g_content"><h3> Become A Respected Mobster</h3><div class="g_text"> <table width='100%'> <tr> <td align='left' width='58%'> You're not a Respected Mobster yet! Why not?<br /><br /> You're missing out!<br /><br /> <a style='font-size: 18px;' href='http://game2.mafiadeath.com/elite.php'>Upgrade Now!<br />Starting From $3.00!</a> </td> <td width='42%'> <li>Energy Regenerates <b><u>Twice</u></b> As Quick</li> <li>Bank Interest is <b><u>DOUBLED</u></b>!</li> <li>Yellow Name</li> <li>Respected Mobster Status</li> <li><b><u>Cash Bonus</u></b> on Purchase</li> <li><b><u>Points Bonus</u></b> on Purchase</li> <li>Access to <b><u>RM Only</u></b> Cities</li> <li><b><u>Larger</u></b> Inventory Size</li> </td> </tr> </table></div></div> OUTPUT; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/154652-solved-help-echoing-some-code/#findComment-813250 Share on other sites More sharing options...
soak Posted April 18, 2009 Share Posted April 18, 2009 Yes, although wouldn't it have made more sense to try the code that you've just been given rather than asking again if it will work? Now I have visions of you being will smith trying to save the world from an alien invasion and only getting one chance to get the website correct :-D Quote Link to comment https://forums.phpfreaks.com/topic/154652-solved-help-echoing-some-code/#findComment-813251 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.