Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

rate_success change - pugdog?

Quote Reply
rate_success change - pugdog?
As you can tell from the lack of recent postings I am having very few problems with LinksSQL now! However there is one thing I really want to do.

When a user rates a site I want the program to count their vote but re-direct them to our home page and NOT the rate_success page. The problem is that our home page is not created by a template (i.e. a redirect to home.html wouldn't do). We need the program to redirect to an URL.

I think this is the code (from HTML_Templates.pm) that needs changing.

Code:
sub site_html_rate_success {
# --------------------------------------------------------
# This routine determines how the rate success page will look like.
#
my ($tags, $dynamic) = @_;
my $template = defined $dynamic ? $dynamic->param('t') : undef;
(ref $tags eq 'HASH') or croak "HTML_TEMPLATES: Argument '$tags' must be hash reference";

defined $dynamic and &load_user ($dynamic, $tags);
my $output = &load_template ('rate_success.html', {
%$tags,
%GLOBALS
}, undef, $template);
defined $dynamic and &clean_output($dynamic, \$output);
print $output;
}
Please help asap.

JeffB
http://www.celebhoo.com


Quote Reply
Re: rate_success change - pugdog? In reply to
Nope...actually, you would need to replace the following codes in the rate.cgi page:

Code:

&site_html_rate_sucess ($in, $dynamic);


with the following codes:

Code:

print $in->redirect("http://www.yourdomain.com/") and return;


Regards,

Eliot Lee


Quote Reply
Re: rate_success change - pugdog? In reply to
OK - I tried that but got this error after rating a site:

Status: 302 Moved Location: http://www.celebhoo.com/ Content-Type: text/html

Any ideas why?

Quote Reply
Re: rate_success change - pugdog? In reply to
Did you try giving it an actual file path, not a directory (which is in itself a re-direction)?

(print $in->redirect("http://www.yourdomain.com/index.html")) or (return &error ("Page not found: $id"));

I'm _NOT_ sure you want to _AND_ the return.

Once you "print" the output, and redirect to a new page, you want to end processing, rather than return. You'd only want to return if you were unable to print or redirect for some reason... ie: the left side was "FALSE" so the right side of the OR had to be evaluated for a TRUE.

Does someone know for sure? (I've hated logic since High School!)

http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: rate_success change - pugdog? In reply to
That didn't work either - and don't ask me about logic Smile

Would it be easier to edit the code in HTML_Templates.pm or does someone know how we can fix this?

Please help asap!

Quote Reply
Re: rate_success change - pugdog? In reply to
Pugdog/Elliot/Alex?!

Can no one tell me how you can redirect the user to a different URL after they have rated a site. I could use a refresh meta tag on a middle page but this is messy and it would be much better to hack the code so when the user clicks on the "Rate It" button their vote is counted and they are taken to a new URL.

Help guys! This is becoming an old thread now!

Quote Reply
Re: rate_success change - pugdog? In reply to
(print $in->redirect("http://www.yourdomain.com/index.html")) or (return &error ("Page not found: $id"));


I was having a 302 error with some pages using that, and I'm not sure how I fixed it. Or if I fixed it. You need to keep tweaking the code.

Might want to check to see if you are printing a header too many times or not.

I'm not sure if the $in->redirect needs an $in->header or if that causes an error.

No way to play with this at the moment....

But also, if you want to redirect rather than print out a page, there is no reason to make a call to &site_html_rate_success, replace _THAT_ with the line above.

http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: rate_success change - pugdog? In reply to
Hi!

You need to remove:

print $in->header('text/html');

from line 52 (that prints the header if the user has rated), then replace:

&site_html_rate_success ( $rec, $dynamic );

with:

print $in->redirect ( success_url );

and:

&site_html_rate_failure ( $rec, $dynamic);

with:

print $in->redirect ( failure_url );

Cheers,

Alex



--
Gossamer Threads Inc.