TinyPortal

Development => Block Codes => Topic started by: akulion on September 13, 2006, 02:17:39 PM

Title: E-Mail This Page Script
Post by: akulion on September 13, 2006, 02:17:39 PM
Hi

Ok this is a nice little thingie - what it does is wherever you place the form for it it will take the address of that page and send it via e-mail to whoever you want.

So this way your users can recommend a specific page to people

This little thingie is best used with articles to recommend individual articles to people.

Download this file (http://path-to-peace.net/misc/sendpage.zip) and upload to ur forum root, customizations can be done inside the php file to change web address and message

Place at the end of your articles this code (i havent used articles much but you must place this in the template itself):



<form method=post action=tellck.php>
      <table  border="0" cellpadding="0" cellspacing="0" align=center>
<tr bgcolor='#f1f1f1'><td colspan=2 align=center><font face='Verdana' size='2' ><b>TELL A FRIEND</b></font></td></tr>

<tr><td width=100><font face='Verdana' size='2' >Your Name</font></td><td width=200><input type=text name=y_name></td></tr>
<tr bgcolor='#f1f1f1'><td><font face='Verdana' size='2' >Your Email</font></td><td><input type=text name=y_email></td></tr>
<tr ><td><font face='Verdana' size='2' >Your Friend's Name</font></td><td><input type=text name=f_name></td></tr>
<tr bgcolor='#f1f1f1'><td><font face='Verdana' size='2' >Friend's Email</font></td><td><input type=text name=f_email></td></tr>
<tr ><td><font face='Verdana' size='2' >Your Message</font></td><td><textarea name=y_msg rows=5 cols=20></textarea></td></tr>

<tr bgcolor='#f1f1f1'><td colspan=2 align=center><font face='Verdana' size='2' ><input type=submit value='Send'></font></td></tr>
</table>
</form>



You can modify the code as necessary to suit colors etc...

A crappy lil demo cn be found on this page (http://path-to-peace.net/misc/phptest/zimzim2.php) - i was just testing stuff so the page looks crap..just browse to the bottom to see it

sorry i havent provided details about hot to integrate into the articles template, but i dont use articles so ull have to ask one of the other support guys.

Aku

PS...

oh yea i forgot to mention, thats a working demo so you can email yourself to see how it works :)


Title: Re: E-Mail This Page Script
Post by: IchBin on September 13, 2006, 02:35:36 PM
Thats very cool! What would be a nice feature is if it was a link at the bottom of an article, and when the link is clicked it dynamically opens the form without having the reload the page.
Title: Re: E-Mail This Page Script
Post by: akulion on September 13, 2006, 02:38:10 PM
yea i tried using IFRAME but failed up till now

the problem arises because the script will only take the addy of the page it is located on..so if you place it as a stand alone, it recommends the form address

im thinking maybe something like a "collapsed block" when u click it - it opens the form up...that way it will already be on that page

Also Ichbin can you shed some light about how to integrate this into the articles template if u have the time please?

thanks
Title: Re: E-Mail This Page Script
Post by: Polymath on March 16, 2007, 05:58:24 PM
How do I stop it from checking names and email... I get not correct errors.

Any idea?
Title: Re: E-Mail This Page Script
Post by: IchBin on March 16, 2007, 06:10:30 PM
What are you getting an error on? The email or name is not correct?

in the tellck.php file you'll see this code which verifies all your input.

$status = "OK";
$msg="";
if (!stristr($y_email,"@") OR !stristr($y_email,".")) { // checking your email
$msg .="Your email address is not correct<BR>";
$status= "NOTOK";}

if (strlen($y_name) <2 ) { // checking your name
$msg .="Please enter your name<BR>";
$status= "NOTOK";}

if (!stristr($f_email,"@") OR !stristr($f_email,".")) { // checking friends email
$msg .="Your Friends address is not correct<BR>";
$status= "NOTOK";}

if (strlen($f_name) <2 ) { // checking freinds name
$msg .="Please enter your friend's name<BR>";
$status= "NOTOK";}

if (strlen($y_msg) <2 ) { // checking Message details
$msg .="Please enter your message details<BR>";
$status= "NOTOK";}
Title: Re: E-Mail This Page Script
Post by: Polymath on March 17, 2007, 04:08:46 AM
   Damn this not work for me..ohhh well

Your email address is not correct
Please enter your name
Your Friends address is not correct
Please enter your friend's name
Please enter your message details
Title: Re: E-Mail This Page Script
Post by: Solomon on June 07, 2007, 11:10:38 AM
It works as advertised.
However, what would be *really* good is a simple 'Email this page to a friend' link, such as found on every page of the BBC site.
Perhaps the script here can be adjusted to run on its own page, and the template modded to run just the hyperlink.