[FX.php List] Pegging the CPU with PHPMailer
Joel Shapiro
jsfmp at earthlink.net
Thu May 15 12:05:19 MDT 2008
Seeking clarification:
Braces {curly brackets} are used to wrap variables when inside either
double-quoted or heredoc strings, but not within single-quoted strings.
Is that correcct?
-Joel
On May 15, 2008, at 10:47 AM, Gjermund Gusland Thorsen wrote:
> Try this:
>
> <?php
> $name = $findData['name'][0]; //find the value from FMP
>
> echo <<<output
> My name is {$name}
> output;
> ?>
>
> 2008/5/15 Jonathan Schwartz <jschwartz at exit445.com>:
>> Will look at Smarty.
>>
>> In the meantime, I can't get Heredoc to work with my set up.
>>
>> This is what I have:
>>
>> $htmlstring = "My name is $name."; // My template
>> $name = $findData['name'][0]; //find the value from FMP
>>
>> echo <<<EOT
>> $htmlstring
>> EOT;
>>
>>
>> It doesn't replace the variable with the value. Everything I try
>> generates
>> a syntax error.
>>
>> How do I do this?
>>
>> J
>>
>> At 6:19 PM +0200 5/15/08, Gjermund Gusland Thorsen wrote:
>>>
>>> Alternatively if you have to do alot of stuff like that, perhaps
>>> learning smarty is the way to go...
>>>
>>> ggt
>>>
>>> 2008/5/15 Jonathan Schwartz <jschwartz at exit445.com>:
>>>>
>>>> This is evidence that I try and solve challenges myself before
>>>> asking
>>>> the
>>>> list.
>>>>
>>>> Heredoc looks like a better alternative that the iterative
>>>> method I
>>>> created.
>>>>
>>>> Thanks.
>>>>
>>>> Anyone got a wheel that needs recreating? ;-)
>>>>
>>>> Jonathan
>>>>
>>>> At 8:50 AM +0200 5/15/08, Gjermund Gusland Thorsen wrote:
>>>>>
>>>>> Ehh, how about using heredoc?
>>>>>
>>>>> ggt
>>>>>
>>>>> 2008/5/15 Jonathan Schwartz <jschwartz at exit445.com>:
>>>>>>
>>>>>> Hi Folks,
>>>>>>
>>>>>> I'm looking for some advice on being more efficient with my
>>>>>> new mass
>>>>>> mail
>>>>>> script using PHPMailer.
>>>>>>
>>>>>> The problem is that I am pegging the CPU during the send.
>>>>>>
>>>>>> My first idea is that I am doing "mail merge" badly. I'm
>>>>>> doing it
>>>>>> live,
>>>>>> replacing homemade variables during the send. I'm using
>>>>>> Str_replace to
>>>>>> insert the values into the html lettter:
>>>>>>
>>>>>>
>>>>>> $newhtmlstring =str_replace("{name}",$findData['name'][0],
>>>>>> $htmlstring);
>>>>>> $newhtmlstring= str_replace("{email}",$findData['email'][0],
>>>>>> $newhtmlstring);
>>>>>> $newhtmlstring= str_replace("{MID}",$findData['MailID'][0],
>>>>>> $newhtmlstring);
>>>>>> $newhtmlstring= str_replace("{folder}",$findData['data5'][0],
>>>>>> $newhtmlstring);
>>>>>> $newhtmlstring= str_replace("{data1}",$findData['data1'][0],
>>>>>> $newhtmlstring);
>>>>>> $newhtmlstring= str_replace("{data2}",$findData['data2'][0],
>>>>>> $newhtmlstring);
>>>>>> $newhtmlstring= str_replace("{data3}",$findData['data3'][0],
>>>>>> $newhtmlstring);
>>>>>>
>>>>>> The html field contains the home made {fieldname} entries.
>>>>>>
>>>>>> How bad of a technique is this? The html field is about 5k.
>>>>>>
>>>>>> Thx
>>>>>>
>>>>>> jonathan
>>>>>> --
>>>>>> Jonathan Schwartz
>>>>>> Exit 445 Group
>>>>>> jonathan at exit445.com
>>>>>> http://www.exit445.com
>>>>>> 415-381-1852
>>>>>> _______________________________________________
>>>>>> FX.php_List mailing list
>>>>>> FX.php_List at mail.iviking.org
>>>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>>>>
>>>>> _______________________________________________
>>>>> FX.php_List mailing list
>>>>> FX.php_List at mail.iviking.org
>>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>>
>>>>
>>>> --
>>>> Jonathan Schwartz
>>>> Exit 445 Group
>>>> jonathan at exit445.com
>>>> http://www.exit445.com
>>>> 415-381-1852
>>>> _______________________________________________
>>>> FX.php_List mailing list
>>>> FX.php_List at mail.iviking.org
>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>>
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>>
>> --
>> Jonathan Schwartz
>> Exit 445 Group
>> jonathan at exit445.com
>> http://www.exit445.com
>> 415-381-1852
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
More information about the FX.php_List
mailing list