Jump to content

[SOLVED] help echoing some code.


seany123

Recommended Posts

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>

Link to comment
https://forums.phpfreaks.com/topic/154652-solved-help-echoing-some-code/
Share on other sites

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.

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;
}
?>

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.