Forum Moderators: coopster
Can someone please give me a brief overview of how to do it, just to kickstart my learning?
I understand that. What I meant was, what are the ways in which such a thing can be done?
For example, are there scripts which let you do it?
Here's what I want . . .
1) A visitor clicks the "E-mail" button
2) An e-mail form pops up, pre-populated with the content
3) All the visitor has to do is enter the person's e-mail, before clicking "Send"
Or . . .
1) A visitor clicks the "Share" link
2) A box appears with the logos of all the popular bookmarking sites
3) All the visitor has to do is choose a site, which is then pre-populated with the content
What you can do is use some good Javascript code to make the user experience more... enjoyable:
1. Create a link that when clicked will popup a new window. Something like <a href="#" onClick="openWindow()">Send To A Friend</a>. Use the function "window.open(url,'name','height=200,width=150');" (with your own parameters) in your openWindow() function to open the window.
2. That popup window will have a form. Use PHP to process the form if the form has been submitted. When submitted, process the form and use the PHP function mail() to send a message containing the link to your article to the email specified in the form.
Good luck. You shouldn't have problems doing this. It is pretty straight forward.
As for bookmarking, I recall that Digg had a few methods of adding a link on your site that would add the link to Digg. I believe one was a Digg button, but there was a URL you could copy to use a custom version of the button where you could add your own image or link.
As for mailing, I personally when possible use a free library called 'Swift Mailer'. It's free, fully featured and a lot quicker than the mail() function.
Be warned, it doesnt work on all hosts like GoDaddy for example, but the mail() function isn't always enabled either(Some hosts disable the use of it because it's very slow)
Swift Mailer makes it much easier to send html email, and large batches of email if need be. I suggest you Google "PHP swift mailer'