SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    ********* Addict
    Join Date
    Apr 2000
    Location
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I want to use the "let 'em know" service to allow my visitors to send certain pages to friends. However, I do have a problem: I want it to send the current page, not the home page. Also I want a new windows to pop up with a form so they could fill it up. I don't have CGI. Any help would be great.

  2. #2
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    What's the "let 'em know" service?


    ------------------
    -Kevin Yank.
    http://www.SitePoint.com/
    Helping Small Business Grow Online!

  3. #3
    ********* Addict
    Join Date
    Apr 2000
    Location
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The let 'em know service is a free service which lets your visitors send pages to friends using automated forms. If you don't know what I mean, go to http://www.letemknow.com/.

  4. #4
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi, Pedro!

    Okay, after looking at the "let 'em know" service, what you want is definitely possible!

    First, let's look at referring the current page instead of the homepage. Let 'Em Know lets you specify which page to refer using the "refer_url" field. In the code for your referral form you should see something like this:

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>&lt;input type="hidden" name="refer_url" value="http://www.yoursite.com"&gt;[/code]

    The URL in there is the site that will be referred when someone uses the form. So to allow users of your site to refer any given page to a friend, you'd just have to make sure that the form on each page has the appropriate URL set in the form.

    Your second request is a little more complicated. You want users of your site to bring up a pop-up window with the "Let 'em Know" form in it. Creating the pop-up window is just a matter of a little JavaScript, but creating the document to be loaded into that pop-up window takes a little more doing.

    Obviously, you could create a different pop-up .html file for every page on your site so that you could just set the "refer_url" field (as described above) in each of these HTML files by hand. Typing out and maintaining all those HTML files would be a real pain in the butt.

    Instead, it would be a good idea to create a single HTML file that you could somehow "tell" what "refer_url" to use. Without using CGI, you have two ways of doing this, both of which require a little JavaScript. Let me show you what I would consider the easiest way.

    In the header (between &lt;HEAD&gt; and &lt;/HEAD&gt; of each page of your site (or at least each page that you want people to be able to refer), add the following:

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>
    &lt;SCRIPT LANGUAGE="JavaScript"&gt;
    &lt;!--

    var refer_title = "Title of this page";

    var refer_url = "http://www.yoursite.com/thispage.html";

    var refer_description = "A brief description of this page.";

    function popup_refer() {
    window.open('referral.html','referwin','width=550,height=440,resizeable');
    }

    //--&gt;
    &lt;/SCRIPT&gt;
    [/code]

    The above JavaScript code sets the title, URL, and description of the current page that will be used when someone wants to make a referral to this page. Just set the values appropriately on each page.

    Next, you need to create your link that will pop up the window to make the referral. The code for this is pretty simple:

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>&lt;A HREF="javascriptopup_refer();"&gt;Refer this page to a friend!&lt;/A&gt;[/code]

    Of course, you can make the link an image if you want to.

    That's it for the code on each of your site's pages. Now all that's left is to write referral.html, which is the HTML page that will be loaded into the pop-up window whenever someone wants to refer a page of your site. Here's the code (this is a modified version of the code posted at http://www.letemknow.com/):

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>
    &lt;SCRIPT LANGUAGE="JavaScript"&gt;
    &lt;!--

    // Retrieve values from the window that opened the pop-up
    var refer_title = opener.refer_title;
    var refer_url = opener.refer_url;
    var refer_description = opener.refer_description;

    //--&gt;
    &lt;/SCRIPT&gt;

    &lt;!-- BEGIN SAMPLE LET 'EM KNOW REFERRAL CODE --&gt;
    &lt;form action="http://www.letemknow.com/cgi-bin/letemknow.cgi" method="POST"&gt;

    &lt;input type="hidden" name="member_id" value="yourID"&gt;

    &lt;SCRIPT LANGUAGE="JavaScript"&gt;
    &lt;!--
    document.write('&lt;input type="hidden" name="refer_title" value="' + refer_title + '"&gt;');
    document.write('&lt;input type="hidden" name="refer_url" value="' + refer_url + '"&gt;');
    document.write('&lt;input type="hidden" name="refer_description" value="' + refer_description + '"&gt;');
    //--&gt;
    &lt;/SCRIPT&gt;

    &lt;input type="hidden" name="return_url" value="http://www.yoursite.com/thanks.html"&gt;

    &lt;center&gt;&lt;table border="0" cellpadding="5" cellspacing="0"&gt;

    &lt;tr&gt;&lt;td colspan="3" bgcolor="#0060c0" align="center"&gt;&lt;font face="arial" size="-1"
    color="#ffffff"&gt;&lt;b&gt;Know anyone who might enjoy this site?&lt;br&gt;
    Please ... Let 'em Know!&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;

    &lt;tr align="center"&gt;&lt;td bgcolor="#c0c0c0"&gt;*&lt;/td&gt;
    &lt;td bgcolor="#c0c0c0"&gt;&lt;font face="arial" size="-1"&gt;&lt;b&gt;Full Name&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
    &lt;td bgcolor="#c0c0c0"&gt;&lt;font face="arial" size="-1"&gt;&lt;b&gt;Email Address&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;

    &lt;tr align="center"&gt;&lt;td align="right" bgcolor="#c0c0c0"&gt;
    &lt;font face="arial" size="-1"&gt;&lt;b&gt;You&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
    &lt;td bgcolor="#c0c0c0"&gt;&lt;input type="text" name="visitor_name" size="12"&gt;&lt;/td&gt;
    &lt;td bgcolor="#c0c0c0"&gt;&lt;input type="text" name="visitor_email" size="15"&gt;&lt;/td&gt;&lt;/tr&gt;

    &lt;tr align="center"&gt;&lt;td align="right" bgcolor="#c0c0c0"&gt;
    &lt;font face="arial" size="-1"&gt;&lt;b&gt;Friend&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
    &lt;td bgcolor="#c0c0c0"&gt;&lt;input type="text" name="friend_name" size="12"&gt;&lt;/td&gt;
    &lt;td bgcolor="#c0c0c0"&gt;&lt;input type="text" name="friend_email" size="15"&gt;&lt;/td&gt;&lt;/tr&gt;

    &lt;tr align="center"&gt;&lt;td colspan="3" bgcolor="#c0c0c0"&gt;&lt;font face="arial" size="-1"&gt;
    &lt;input type="checkbox" name="tell_me_more"&gt; Tell me how to add a referral
    form to my site.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;

    &lt;tr&gt;&lt;td colspan="3" align="center" bgcolor="#0060c0"&gt;
    &lt;input type="submit" value="Let 'em Know!"&gt; &lt;input type="reset" value="Reset"&gt;&lt;/td&gt;&lt;/tr&gt;

    &lt;/table&gt;&lt;/center&gt;&lt;/form&gt;
    &lt;!-- END SAMPLE LET 'EM KNOW REFERRAL CODE --&gt;
    [/code]

    That should do it! Let me know if you have any questions!


    ------------------
    -Kevin Yank.
    http://www.SitePoint.com/
    Helping Small Business Grow Online!

    [This message has been edited by kyank (edited May 19, 2000).]

  5. #5
    ********* Addict
    Join Date
    Apr 2000
    Location
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a lot for that, kyank! You've told me exactly what I wanted! Again, thanks a lot!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •