![]() |
sponsored links |
|
|
sponsored links
|
|
|
2
10th April 13:25
External User
Posts: 1
|
What you have will work, you just need to escape out the double quotes in
the html. -- Stephen Johnson The Lone Coder http://www.ouradoptionblog.com *Join us on our adoption journey* stephen@thelonecoder.com http://www.thelonecoder.com *Continuing the struggle against bad code* -- |
|
|
|
8
10th April 16:44
External User
Posts: 1
|
Quote:
" You could just swap all the double quotes in the HTML tags for single quotes - that would work in this instance... $myblokvar = " <table width='487' border='0' cellspacing='0' cellpadding='0'> .... </table> "; " That's a way too, but it does not preserve the indentation. The HEREDOC syntax behave much like the <pre> HTML tag for PHP, and it also removed the hassle of placing escape tags! Xavier de Lapeyre Web Developer Enterprise Data Services 24, Dr Roux Street, Rose Hill Office: (230) 465 17 00 Fax: (230) 465 29 00 Site: http://www.eds.mu -----Original Message----- From: Peter Ford [mailto ete@justcroft.com] Sent: jeudi 20 décembre 2007 13:17 To: php-general@lists.php.net Subject: Re: [php] Assign variable to a block of html code You could just swap all the double quotes in the HTML tags for single quotes - that would work in this instance... $myblokvar = " <table width='487' border='0' cellspacing='0' cellpadding='0'> .... </table> "; Or perhaps a HereDoc syntax: $myblokvar = <<<EndOfMyHTMLBlock <table width="487" border="0" cellspacing="0" cellpadding="0"> .... </table> EndOfMyHTMLBlock; Then you don't need to worry about what quotes you use, and if you start putting stuff like onclick events in you can mix quotes up happily ... I go to great lengths to avoid escaping quotes - it just looks ugly. That is, however, a personal foible. Cheers Pete -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
|
9
10th April 16:44
External User
Posts: 1
|
Yeps,
Sorry bout that. Thnks for pointing it out. Xavier -----Original Message----- From: Darren Whitlen [mailto:darren@sirdaz.com] Sent: jeudi 20 décembre 2007 13:13 To: php-general@lists.php.net Subject: Re: [php] Assign variable to a block of html code 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|