Gossamer Forum
Home : Products : Links 2.0 : Customization :

Updated "Recommend It" Mod

Quote Reply
Updated "Recommend It" Mod
I have updated the instructions for the Recommend It Mod. Instructions for both birdcast.cgi v1.0 and v2.0 are included.

You can find the link from the Gossamer Threads Resource center.

Let me know if there are any problems.
Quote Reply
Re: Updated "Recommend It" Mod In reply to
Bobsie,

Great mod! I have just installed it at http://www.links.gotzespace.dk and it works fine (I'm yet to adapt it to my site's looks etc.).

Two issues/questions:

1. I am trying to change the URL in the mail to be the real URL and not the jump.cgi-URL, but have difficulties doing so. Any suggestions?

2. I would like to include not only the title and URL but also the site description. This causes me even more problems ... soooo, any ideas here?

Cheers
John
Quote Reply
Re: Updated "Recommend It" Mod In reply to
  
Quote:
1. I am trying to change the URL in the mail to be the real URL and not the jump.cgi-URL, but have difficulties doing so. Any suggestions?

If you are using templates, change the following that appears in step 2., line 4:

Quote:
<a href="/path/to/birdcast2.cgi?rec_url=<%db_cgi_url%>/jump.cgi?ID=<%ID%>

to read:

Quote:
<a href="/path/to/birdcast2.cgi?rec_url=<%URL%>

If not using templates, change the following that appears in step 4.b., line 4:

Quote:
<a href="/path/to/birdcast2.cgi?rec_url=$build_jump_url?ID=$rec{'ID'}

to read:

Quote:
<a href="/path/to/birdcast2.cgi?rec_url=$rec{'URL'}

And,

Quote:
2. I would like to include not only the title and URL but also the site description. This causes me even more problems ... soooo, any ideas here?

You will need to do something similar with the description as was done for $rec_title (i.e., "$rec_desc = $rec{'Description'};") and then include it as a hidden value in the form (step 1.b.4.) and add it to birdcast.cgi along with $fields{'rec_title'} and $fields{'rec_url'} in Step 3 of the instructions. I hope that is clear.

I hope this helps.

[This message has been edited by Bobsie (edited May 06, 1999).]
Quote Reply
Re: Updated "Recommend It" Mod In reply to
Thanks Bobsie,

Issue 1 was so simple even I should have thought of it .... fixed it, and it works fine.

Issue 2. I was trying this, but it doesn't seem to work. Might it be that the method gives too long URLs when executing birdcast.cgi? In other words, is there a way to pull out the description with having it in the URL-string?

John

Quote Reply
Re: Updated "Recommend It" Mod In reply to
You could have bircast.cgi open the links.db file and pull up the description (just pass the ID to it in a hidden <input> tag so you can tell it what record to get the description for).

At the top of birdcast.cgi, just add some require lines:

Quote:
require "/path/to/links.cfg";
require "$db_script_path/links.def";
require "$db_script_path/db_utils.pl";

I think that is all you would need. Then call:

Quote:
@values = &get_record($fields{'ID'});

The description would then be available in $values[5].

This is pretty generic and may be a bit over simplified, but is intended to point you to the right track. Let me know how it goes.

As a matter of fact, this just gave me a brainstorm. I might just pass the ID to birdcast.cgi instead of all that other stuff, and then get the record for the title and url as well... hmmm... Time for another mod to my mod?

[This message has been edited by Bobsie (edited May 08, 1999).]
Quote Reply
Re: Updated "Recommend It" Mod In reply to
Hi Bobsie -

The require part makes sense. But the bit about $values[5] doesn't :-( I can't figure out how to call this in the mailroutine.

Also, I can't figure wther I need to do something in the site_html template?

I hope your brainstorming session will result in a new mod'ed mod ;-)

Cheers
John
Quote Reply
Re: Updated "Recommend It" Mod In reply to
  
Quote:
But the bit about $values[5] doesn't :-( I can't figure out how to call this in the mailroutine.

The purpose of the require statements is to allow you to call the subroutines in db_utils.pl. One of those subroutines is sub get_record which returns an array of the record fields. This array is @values, based on the call I suggested:

Quote:
@values = &get_record($fields{'ID'});

Now, each field is accessible by indexing @values, starting at 0. When accessing the array, you use $values (instead of @values) and specify an index number. The description is the 6th field of a link record, but since the indexing starts at 0 (which is the ID field itself), we use the number 5 for our index to get the description. Thus, $values[5] is used to access the description. You could write something like:

Quote:
$link_title = $values[$db_title];
$link_url = $values[$db_url];
$link_desc = $values[5];

after the call to sub get_record.

You could then use $link_title and $link_url instead of $fields{'rec_title'} and $fields{'rec_url'} and could use $link_desc as well. I hope this is clearer now.

Quote:
Also, I can't figure wther I need to do something in the site_html template?

I'll work on an updated version of this mod in a bit and let you know when it is done. That would be easier than trying to explain it all here. Hopefully it will be done today but, if not, certainly by tomorrow.

[This message has been edited by Bobsie (edited May 08, 1999).]