putting variables in a variable

putting variables in a variable

am 28.03.2008 12:07:44 von Hulf

Hi,

I am making and HTML email. I have 3 images to put in. Currently I have

$body .="










";


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



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: putting variables in a variable

am 28.03.2008 12:58:35 von Peter Ford

Hulf wrote:
> Hi,
>
> I am making and HTML email. I have 3 images to put in. Currently I have
>
> $body .="
>


>
>
>
>
>
>
>
>

> ";
>
>
> 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 .="





";

I'd probably use single-quotes (') around the src attribute to avoid those ugly
backslashes ...

$body .="





";

Might be better in this case to use heredoc syntax ...

$body .<<




EndOfChunk;

--
Peter Ford phone: 01580 893333
Developer fax: 01580 893399
Justcroft International Ltd., Staplehurst, Kent

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: putting variables in a variable

am 28.03.2008 15:33:35 von parasane

On Mon, Mar 28, 2011 at 7:06 AM, Hulf wrote:
> Hi,
>
> I am making and HTML email. I have 3 images to put in. Currently I have
>
> $body .="
>


>
>
>
>
>
>
>
>

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

Consider HEREDOC syntax. I'm not sure why you're doing your
tables like that, but I'm sure you have your reasons. Also, I'm
certain that hardcoding the image names like that is just for example,
since it would be much easier to use an array or something similar (if
it's not coming from a database or otherwise dynamically-generated).


$myimage1 = "image1.png";
$myimage2 = "image2.png";
$myimage3 = "image3.png";

$body .=<<


















 
 
 

EOT; // This has to be at position one on the line, no matter what.
?>

And, for good measure, the array way:


$images = array('image1.png','image2.png','image3.png');

echo "\n";

foreach($images as $p => $v) {
$body .=<<






EOT; // Notice the blank line. That ensures a linebreak after the last
}

echo "
 
\n";
?>

--

Forensic Services, Senior Unix Engineer
1+ (570-) 362-0283

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: putting variables in a variable

am 28.03.2008 15:51:42 von LoneWolf

---- Hulf wrote:
> Hi,
>
> I am making and HTML email. I have 3 images to put in. Currently I have
>
> $body .="
>


>
>
>
>
>
>
>
>

> ";
>
>
> 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

First, you need to change the date on your mail server, since it is reporting the year to be 2011, which in most cases and most servers I run automagically sets you as a spammer and reports the email and domain to the authorities and blacklists you.

Secondly, if you want to use a variable, you need to make sure you are doing the $image1.jpg inside the body, because according to the snippet of code you have done, the $ is missing.

HTH,
Wolf

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: putting variables in a variable

am 28.03.2008 16:47:05 von Tularis

Hulf wrote:
> Hi,
>
> I am making and HTML email. I have 3 images to put in. Currently I have
>
> $body .="
>


>
>
>
>
>
>
>
>

> ";
>
>
> 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
My first idea is to ask you what you WANT exactly and what's wrong with
what you have. Currently you're showing 1 string, and 3 variables.
Nothing else... what do you expect to happen that is not hapenning? Or
what do you expect not to happen that IS hapenning ?



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: putting variables in a variable

am 28.03.2008 16:53:31 von TedD

At 4:47 PM +0100 3/28/08, M. Sokolewicz wrote:
>Hulf wrote:
>>Hi,
>>
>>I am making and HTML email. I have 3 images to put in. Currently I have
>>
>>$body .="
>>


>>
>>
>>
>>
>>
>>
>>
>>

>>";
>>
>>
>>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
>My first idea is to ask you what you WANT exactly and what's wrong
>with what you have. Currently you're showing 1 string, and 3
>variables. Nothing else... what do you expect to happen that is not
>hapenning? Or what do you expect not to happen that IS hapenning ?

I think it's fuzzy thinking.

He probably wants:

$body .="









";

Where $image.jpg is "image1.jpg" or "image2.jpg" or "image3.jpg"

Cheers,

tedd

--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: putting variables in a variable

am 19.04.2008 23:40:48 von revDAVE

On 3/28/2011 4:06 AM, "Hulf" wrote:

> Hi,
>
> I am making and HTML email. I have 3 images to put in. Currently I have
>
> $body .="
>


>
>
>
>
>
>
>
>

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


I'm just a newbie - but

I did something like this (non - html mail) ... If it helps...

I created this var called $thebody - then stuck it in the mail tag... And it
works

--------------


$thebody = 'This is a some info...

UserID#: '. $_SESSION['nowuser'].'
Company: '.$_SESSION['now_co'].'

Worker Info: '. $edit_result_row->getField('First').' '.
$edit_result_row->getField('Last').'

Thanks,

';

---------------
--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists]




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: putting variables in a variable

am 25.04.2008 04:10:48 von Yannick Warnier

Le lundi 28 mars 2011 =E0 12:06 +0100, Hulf a =E9crit :
> Hi,
>=20
> I am making and HTML email. I have 3 images to put in. Currently I have
>=20
> $body .=3D"
>


>
>
>
>=20
>
>
>
>

> ";
>=20
>=20
> ideally I would like to have
>=20
> $myimage1 =3D "image1.jpg";
> $myimage2 =3D "image2.jpg";
> $myimage3 =3D "image3.jpg";
>=20
>=20
> and put them into the HTML body variable. I have tried escaping them in=20
> every way i can think of, dots and slashes and the rest. Any ideas?

The question is not very clear to me, but doesn't the following give
what you are trying to get?

$myimage1 =3D "image1.jpg";
$body .=3D"









";

Otherwise, could you explain your intentions in another way?

Yannick


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: putting variables in a variable

am 21.07.2009 18:12:46 von Mark Kelly

Ross,

If I understand correctly what you want to do, you're almost there...

You need:

$myimage1 = "image1.jpg";
$myimage2 = "image2.jpg";
$myimage3 = "image3.jpg";

$body .="












";

Cheers,

Mark


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php