Msg#: 3750982 posted 5:55 am on Sep 24, 2008 (gmt 0)
Next to the content on many web sites it is now commonplace to find options to share the content on bookmark sites or e-mail the content to friends. For example, such options occur beneath YouTube videos. I want to do the same on my web site. The problem is, I haven't the slightest clue as to how it's done.
Can someone please give me a brief overview of how to do it, just to kickstart my learning?
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'