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

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.