Re: Assign variable to a block of html code

From: Date: Thu, 20 Dec 2007 09:13:09 +0000
Subject: Re: Assign variable to a block of html code
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-266142@lists.php.net to get a copy of this message
Xavier de Lapeyre wrote:
You should try the HEREDOC structure. See link: http://php.net/heredoc It should look to something like: $myblokvar = <<<EOF <table blabla> <tr> <td> Welcome $name to this website! </td> </tr> </table> <<<EOF;
Xavier, You should test this before you send it.. it doesn't even parse! The closing EOF should not start with the "<<<". It should only be the identifier ("EOF") followed by ; and a new line. ----- $myblokvar = <<<EOF <table blabla> ..... .... EOF; ----- Darren
No need of quotes or php start/end tags when placing a variable. To use it afterwards simply call the $mylokvar variable. Hope it helped! Xavier Web Developer Site: www.eds.mu -----Original Message----- From: Stephen Johnson [mailto:maillists@thelonecoder.com] Sent: jeudi 20 décembre 2007 07:43 To: php mail; PHP General List Subject: Re: [PHP] Assign variable to a block of html code What you have will work, you just need to escape out the double quotes in the html. On 12/19/07 7:38 PM, "php mail" <php@phi-integration.com> wrote:
Hi All, Is it possible to assign variable to a block of html code ? Something like this : $myblokvar = " <table width="487" border="0" cellspacing="0" cellpadding="0"> <tr>
    <td><table width="487" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><img src="images/bartitle_login.gif" alt="Login" width="475"
height="30" /></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="produk"><table width="100%" border="0" cellpadding="3"
cellspacing="2">
          <tr>
            <td class="katalog">
            <?=$log_info?>
            </td>
          </tr>
          </table></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="produk">&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table></td>
</tr> </table> "; Although example above is not working, what I want to achieve is something like that. Is it possible how can I do that ? Regards, Feris


« previous php.general (#266142) next »