Gossamer Forum
Home : Products : Links 2.0 : Customization :

At Long Last - The "Recommend It" Mod

(Page 1 of 2)
> >
Quote Reply
At Long Last - The "Recommend It" Mod
By popular demand, the "Recommend It" Mod for Links v2.0 is now online at http://www.orphanage.com/...f/recommend_mod.html .

This mod will allow your visitors to your site to recommend, via email, any link in your database. Instructions are provided for both template and non-template usage.

Enjoy! As always, should you run into any problems, be sure to let me know.
Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
Hello Bobsie

I set it up and worked fine, until I noticed that in the form, the URL is still pointing towards the main page. I didnt notice it on your 'how-to' page, so I added it here:

Under sub draw_request change:

<A HREF="$ENV{'HTTP_REFERER'}">$ENV{'HTTP_REFERER'}</A>

to:

<A HREF="$fields{'rec_url'}">$fields{'rec_url'}</A>


It works beautifully!


------------------
Josh
Webmaster
http://stangusa.hypermart.net
http://startours.hypermart.net
Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
Hi Bobsie & JoshStang,

I was set it up, if the title only one word, it work fine, but if the title more than one word, when it builded the page, the url of Recommend it generate as below:

http://www.cari.net.my/cgi-bin/recommend.cgi?rec_url=http://www.cari.net.my/cgi-bin/jump.cgi?ID=835&rec_title=The World Of Alicia

actualy it should be like this:

http://www.cari.net.my/cgi-bin/recommend.cgi?rec_url=http://www.cari.net.my/cgi-bin/jump.cgi?ID=835&rec_title=The%20World%20Of%20Alicia

so how to do this?

Below is the line I add in link.html template:

<font size=1 face=arial>[ <a href="http://www.cari.net.my/cgi-bin/recommend.cgi?rec_url=<%db_cgi_url%>/jump.cgi?ID=<%ID%>&rec_title=<%Title%>">Recom mend It</a> ]</font>

Thanks for your time to helping me!
Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
Josh,

That is intentional and should not be changed. After the recommendation is emailed, the purpose of using HTTP_REFERER is to return the person back to the page from which they clicked "Recommend It". The way you have it, they go to the recommended site (where they probably already had been since they decided to recommend the site to someone). The idea here is to recommend the link to someone else after they have been there, not to go there themselves.

khoon,

The %20 should NOT be added to that. If you do, the %20 will end up in the email message as well. It will also show up on the birdcast page if you display the Title to the person making the recommendation. I have never had a problem with it when using multi-word titles. The title has no affect on the URL.
Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
Bobsie,

Mine does the same thing as khoon's. Only the first word of the title appears. How do we fix this?

Thanks!

------------------
Josh
Webmaster
http://stangusa.hypermart.net
http://startours.hypermart.net
Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
It looks like I goofed and left out a step again. Here is what to do.

If using templates, modify sub site_html_links in site_html_templates.pl as follows:

Quote:
a.Add the following two lines beneath my %rec = @_;

my $rec_title = $rec{'Title'};
$rec_title =~ s/ /%20/g;

b.Add the following to the list of variables in the return &load_template ('link.html', { block of code (the best place is at the top of the list:

rec_title => $rec_title,

If not using templates, add the following two lines to sub site_html_link in site_html.pl right after the my %rec = @_; line:

Quote:
my $rec_title = $rec{'Title'};
$rec_title =~ s/ /%20/g;

I have updated the online mod instructions to reflect those changes.

Sorry for the confusion and thanks for pointing out the problem to me.

[This message has been edited by Bobsie (edited March 19, 1999).]
Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
One more change for non-template usage. In the original mod I put online, it says:

Quote:
&rec_title=$rec{'Title'}">Recommend It</a></small>

in the last line of the mod for sub site_html_link. Change that to read:

Quote:
&rec_title=$rec_title">Recommend It</a></small>

It is updated and correct online as well.

[This message has been edited by Bobsie (edited March 19, 1999).]
Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
Bobsie,

First of all, Thank You for the script. It works fine. Except that instead of showing the link title it is printing out jump.cgi?ID=siteid

However, when clicked upon it takes me to the proper site.

Thanks
Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
Bobsie,
It works great! Thanks for making this mod available to us. This forum wouldn't be the same without your contribution. Keep it up!


Sitedex

Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
Socrates,

Double check everything you did against the instructions. It shouldn't be doing that. Are you using templates?
Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
socrates,

quote
"...instead of showing the link title it is printing out jump.cgi?ID=siteid"

To show title, I changed this code in "birdcast.cgi".

change
---------------------------------
<CENTER>
SUGGEST THIS PAGE TO A FRIEND...<P>
<A HREF="$ENV{'HTTP_REFERER'}">$ENV{'HTTP_REFERER'}</A>
</CENTER>
---------------------------------

to
---------------------------------
<CENTER>
SUGGEST THIS PAGE TO A FRIEND...<P>
<A HREF="$fields{'rec_url'}">$fields{'rec_title'}</A>
</CENTER>
----------------------------------
It will display the title and direct link to that website.


Sitedex
Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
Thank you, sitedex. That is why these instructions were included in the mod:

Quote:
Modify this section to provide the look and feel of your site. Such things as the Links menu, instructions you want to provide, etc. Two variables are available for you to define what is being recommended: $fields{rec_url}, which contains the URL of the link being recommended (the jump.cgi URL is used), and $fields{'rec_title'}, which contains the title of the link being recommended.

I had to let each person do something, after all! Smile

[This message has been edited by Bobsie (edited March 19, 1999).]
Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
Bobsie,

.....now all problems are solved!
It works like rate.cgi, but i dont have time to write a manual. could you please do it for me?

Code:
sub main {
# --------------------------------------------------------
local (%in) = &parse_form;

if ($in{$db_key} =~ /^\d+$/) {
my (%rec) = &get_record ($in{$db_key});
($rec{$db_key} eq $in{$db_key}) ?
&site_html_birdcast_form (%rec) :
&site_html_birdcast_failure ("Unkown Link ID: $in{$db_key}");
}
else {
print "Location: $build_birdcast_url/\n\n";
}
}
Code:
Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
This happened "Internal Server Error" and the URL looked like this:

Quote:
http://www.trisoft.net/recommend/recommend.cgi?rec_url=http://www.trisoft.net/jump.cgi?ID=12&rec_title=Jason%20Tri%20Nguyen's%20Ul timate%20WebSite!


I CHMODed it correctly 0755 for the birdcast2.cgi and created a log text file and CHMODed 777 . Dir or Recommend is 777 . Gone in to site_html.pl and add whatever lines that says in your instructions. After built ALL. search for a string and clicked on "recommend it"... and "Internet Server Error" poped up and the URL showed as I posted on the top.

Any help is GREATLY Appreciated!



------------------
WebKing
WebKing@trisoft.net
http://www.trisoft.net
My ICQ # 25356171
Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
WebKing,

I don't know what to tell you. I went to your site to try it myself but none of your category pages display any links, so I couldn't test it.

Chrishintz,

I have no idea what you are asking of me. Write a manual for what? The code that follows your question? Since I didn't write that code and since I have no idea what it is used for, I have no way of writing a manual for it. Besides, what makes you think that I have time to write anything for you, if you do not have the time yourself? I do have other things to do, you know?
Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
Thanks Guys!

I found out what was wrong (after spending about two hours). One small mistake in my link.html template, that I made. I copied the code from your (Bobsie) site and pasted it in my links.html

the &rec_title=<%rec_title%> was on a seperate line, instead of being a contiuation after <%db_cgi_url%>/jump.cgi?ID=<%ID%>

Because there was a gap in between, the rec_title was not being passed and hence was not printed. One small error, I figured it out when I saw the gap there was between these two, in my browser "Location Toolbar"

Thanks Again.
Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
Sorry about that, Socrates. I had to do that in order to fit everything on the screen. If I had left it as one line, it would have been entirely too long. Maybe I could have put the breaks in a better place so that they wouldn't matter. I'll take a look at that. I may also reduce the font size, but I really hate to do that for a mod.

Thanks for the feedback.
Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
No Problems, Bobsie.
Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
I can not get it to work. When it tries I get a internal server error. Can someone please help. . . .


Thank You,
lpluby
Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
Bobsie,

just a short notice about my rude question (sorry). It was just an idea of how you could modify youre script so it would not have all the problems with title and more.

I just wanted to pionmted you toward the direction of the rate.cgi script (take a look of the source and you'll see).

But if you like the script how it works now, its fine with me.

Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
LPLuby,

The internal error is, in most likelihood, caused by a typo someplace. Perhaps in either the CONFIGURATION section, or in sub draw_request, of the birdcast script.

Since your email to me on this problem says that the original script (birdcast.cgi) works with no problem, this is all I can think of. Everyone, so far, has gotten it to work (especially after I fixed the instructions... Wink, so you should be able to also.

I mention those two parts of the script because they are the only two parts that you have the ability to put your own code in so that it has the look and feel of the rest of your site.

If you want, email me what you have done and I will look it over. Attach the script as a file attachment to your email; please do not include it in the body of your email as my email client reformats anything with long lines in it, forcing me to have to re-edit the blasted stuff... Or, as an alternative, put the script online as a text file and email me the URL and I can look at it that way. Thanks.

Chrishintz,

So, in essence you are suggesting that I change the mod to work similar to rate.cgi with templates and everything? Hmmm... that is something I can look into. Thanks for the suggestion.

[This message has been edited by Bobsie (edited March 21, 1999).]
Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
Bobsie,

you're welcome.....
and sorry for my 'sick' englisch.
(im from holland, and still learning)
Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
chrishintz,

Betcha your English is better than my Dutch! Wink
Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
Michael,

Your change is fine but may not work for all email clients. For example, my email client does not recognize <p> or <a> anchors. It does, however, recognize a URL (i.e., http://, ftp://, etc.) and allows me to click on it to open a browser at the URL or to copy the URL so I can paste it into my browser.

Your change is based on how your email client works. The way I have it is bit more generic and will apply to many more email clients. Your way is fine, just be aware that it may not have the same effect in another email client as it does in yours.
Quote Reply
Re: At Long Last - The "Recommend It" Mod In reply to
Well, I finally got the script to work. Smile
I did change one thing though.

I changed :

Site Name: $fields{'rec_title'}
Site Location: $fields{'rec_url'}

__STOP_OF_MAIL__

I replaced this with :

<p><a href="$fields{'rec_url'}">$fields{'rec_title'}</a></p>

__STOP_OF_MAIL__


This way the person that gets the e-mail does not have to cut and paste and is more likely to click the link.

Note : The </p> must be on the end or the remainder of the e-mail will be all hyperlinked.


Thanks,
Michael Smile
> >