Re: putting variables in a variable
- From: pete@xxxxxxxxxxxxx (Peter Ford)
- Date: Fri, 28 Mar 2008 11:58:35 +0000
Hulf wrote:
Hi,
I am making and HTML email. I have 3 images to put in. Currently I have
$body .="
<table>
<tr>
<td><img src=\"image1.jpg\"></td>
</tr>
<tr>
<td></td>
</tr>
</table>
";
ideally I would like to have
$myimage1 = "image1.jpg";
$myimage2 = "image2.jpg";
$myimage3 = "image3.jpg";
and put them into the HTML body variable. I have tried escaping them in every way i can think of, dots and slashes and the rest. Any ideas?
Ross
Since you've used double quotes, It Should Just Work(TM) ...
$body .="
<table>
<tr>
<td><img src=\"$myimage1\"></td>
</tr>
</table>
";
I'd probably use single-quotes (') around the src attribute to avoid those ugly backslashes ...
$body .="
<table>
<tr>
<td><img src='$myimage1'></td>
</tr>
</table>
";
Might be better in this case to use heredoc syntax ...
$body .<<<EndOfChunk
<table>
<tr>
<td><img src="$myimage1"></td>
</tr>
</table>
EndOfChunk;
--
Peter Ford phone: 01580 893333
Developer fax: 01580 893399
Justcroft International Ltd., Staplehurst, Kent
.
- Prev by Date: How to log APC Cache errors?
- Next by Date: Re: [PHP] Re: optimilize web page loading
- Previous by thread: How to log APC Cache errors?
- Next by thread: Re: putting variables in a variable
- Index(es):
Relevant Pages
|