Web Hosting Talk







View Full Version : passing php data in my newsletter


bambinou
11-30-2009, 10:13 AM
Hello,

I have a page that is constantly updated on my site, how can I copy the infos of that page in our newsletter?
To be more clear, the content is dynamic, would it be possible to copy all my site content into an Iframe inside the newsletter?

So the next time I send the same newsletter,the content will be automatically updated.

do you understand my problem?
Do you have a piece of code I could use for the Iframe please?

Regards,

BamBam

mattle
11-30-2009, 11:10 AM
do you understand my problem?
Do you have a piece of code I could use for the Iframe please?


No.

Do you have a piece of code that you've tried? Post that and we'll take it from there.

bambinou
11-30-2009, 11:33 AM
hI ,

I wish I had some sort of code but I am tottaly new to programming...sorry.

BamBam

No.

Do you have a piece of code that you've tried? Post that and we'll take it from there.

mattle
11-30-2009, 02:02 PM
Ok...I'm still not clear on what it is you're trying to do...are you sending an email in which you want your whole site to appear in an iframe? I would think that you could just use something like:

<iframe src="http://www.example.com"/>

squirrelhost
11-30-2009, 02:09 PM
If your site is dynamic, you probably have a php script
throwing out all the bits.
You may not want the markup stuff and headers, meta tags, etc..,
so create your newsletter with a php script, throwing in the
content (same content as on website therefore, at that time)
into the email - you're just creating the email body here.
Then send it, however you do that.
By grabbing the content you can format it any way you want,
to fit an email more nicely. Only drawback is the email
is 'fixed' at publication time, if that's a drawback.

bambinou
11-30-2009, 02:12 PM
Thanks guys,

I will try body solution, the Iframe and the PHP code being copied directly in the mail to see if it works.

Regards,


BamBam

mattle
11-30-2009, 02:25 PM
PHP has to be parsed and executed by your webserver. You should not include it in the email. Aside from the fact that it won't work, it can be a big security risk, depending on the code.

bambinou
11-30-2009, 03:00 PM
Sorry guys I mispelled my last message,
I meant:
"I will try both solution" not "body solution lol......."

bambinou
11-30-2009, 03:02 PM
So Mattle, having an iframe might be the best thing..no?

mattle
11-30-2009, 03:41 PM
So Mattle, having an iframe might be the best thing..no?

It all depends on the content. What you definitely want to avoid, however is this:

<iframe><? //php code ?></iframe>

The users' mail clients will not execute the PHP. If they are standards-compliant, they should not display it either, but all you'd have to do is "View source" on the email to see your PHP code! If you need to parse PHP within the body of the email, you should source the url so that it is parsed by your web server...

<iframe src="http://www.example.com/mailContent.php"/>

tim2718281
11-30-2009, 03:46 PM
So the next time I send the same newsletter ...

What do you mean by "send"?

bambinou
11-30-2009, 03:46 PM
Thanks Mattle,

You have fixed both my problems in 2 different threads :-)


Regards,


BamBam

mattle
11-30-2009, 06:02 PM
We aim to please :D