Gossamer Forum
Home : Products : Gossamer Links : Discussions :

review_search_results.html error handling

Quote Reply
review_search_results.html error handling
Hi,

In the old review_search_results.html template and the new one there is code for handling <%error%> but I seem to get the error.html page in both cases if the person clicks on a link to see reviews and there are none available.

I was wondering if it was possible to have a specific template, say for example review_search_results_error.html in this case instead of error.html. I may be mistaken and this may be the way I have coded the page and people aren't supposed to be able to click on review_search_results.html if there aren't any reviews.

However I would like there to be a page so that I can say to people : "There aren't any reviews yet but please feel free to post your own review of this link..."

Thanks, John
Significant Media
Quote Reply
Re: [Jag] review_search_results.html error handling In reply to
You can't really do much with the error handling since it all gets sent to the same page (and you can't really differentiate between the different errors anyways). On the category or detailed page, you have the review count, so you should be able to put your message (or link to it) there.

Adrian
Quote Reply
Re: [Jag] review_search_results.html error handling In reply to
I may not be understanding - why can't you edit the language file for that error so that it says what you want?
We don't yet have any reviews for this link. Please feel free to add your review <a href="/cgi-bin/review.cgi?ID=%s;add_review=1">here</a>.
Quote Reply
Re: [afinlr] review_search_results.html error handling In reply to
Hi Laura,
that's what I do at the moment and actually have a very big message since I explain there are no reviews yet and then have some html code that links to the add_review in order to allow people to add a review.
However a few people have sent me emails saying they find it a bit harsh the presentation with Error message since it isn't actually an error on their behalf and why can't I just have a message saying "There are no opinions yet, but please feel free to post your own opinion".

Is there anyway to know what the error is and intercept that specific error from within the error.html page ?

There must be some way to hack the code in the routine for reviews because at one point it must direct the user to the specific error.html page but I was thinking there may be a slightly less obtrusive way around it...

Thanks,

John
Significant Media
Quote Reply
Re: [Jag] review_search_results.html error handling In reply to
The only option here is to edit the code - admin/Links/User/Review.pm.

Adrian
Quote Reply
Re: [brewt] review_search_results.html error handling In reply to
The obtrusive way then Wink

John
Significant Media
Quote Reply
Re: [Jag] review_search_results.html error handling In reply to
I agree - I think it would be better to keep this error as a message in the review templates.
Quote Reply
Re: [brewt] review_search_results.html error handling In reply to
Hi Adrian,

I've created an error page for handling this but I can't seem to get the <%Title%> of the link so all my rewrite rules won't work either. Is it normal that the Title of the link isn't passed through with the error ?

Thanks

John
Significant Media
Quote Reply
Re: [brewt] review_search_results.html error handling In reply to
Hi,

I've modified the Review.pm file and have added this :

Code:
# Return if no results.
unless ($review_hits) {
print $IN->header();
print Links::SiteHTML::display('review_search_no_results', { error => Links::language('REVIEW_NORESULTS', $args->{ID} || $args->{username}), main_title_loop => $mtl });
return;
}

However I now have a page that doesn't display the <%Title%> value at all but does have the ID value. Is it simply a case of adding

$args->{Title}

Or is it going to be a long and complicated one ?!

I'm using mod_rewrite so all the urls get busted without $Title

Thanks, John
Significant Media
Quote Reply
Re: [brewt] review_search_results.html error handling In reply to
Hi,

Looking through the routines that are already available I found load_link_info in Links/Utils.pm but this doesn't seem to get me the tags and I was wondering since the ID of the link is available on the page how is it supposed to be used.

would it be :

<%Links::Utils::load_link_info($Title, $ID => $IN->param('Review_LinkID'))~%>

I'm not sure how the sub load_link_info works ?

Thanks,

John
Significant Media
Quote Reply
Re: [Jag] review_search_results.html error handling In reply to
In French they say something along the lines "never better served than by thyself", this with regards to Perl and myself is not really true but hey, it was worth a try because I've got what I set out to obtain...

I have created a global called : <%review_get_title($ID)%>

Code:
sub {
my $id = $_[0];
my $link_tbl = $DB->table('Links');
my $get_title = $link_tbl->select(['Title'],{ ID => $id },{ isValidated => 'Yes'})->fetchrow;
return {(Title => $get_title)};
}

Inserted into the above template I finally get my Title value and all my rewrite links work.

However I would greatly appreciate it if a Perl whiz could explain to me a simple way to get the ['isNew'],['isChanged'],['isPopular'] values working as well !

Cheers,

John
Significant Media
Quote Reply
Re: [Jag] review_search_results.html error handling In reply to
Well the problem is that at that point, the request could have been one searching for reviews for a link OR reviews that a user has written. If it's reviews for a link, you probably can just call <%set ID = whatever the id is%> <%Links::Utils::load_link_info%> and <%include link.html%>.

Adrian

Last edited by:

brewt: Nov 26, 2005, 3:29 PM
Quote Reply
Re: [brewt] review_search_results.html error handling In reply to
Hi Adrian,

I have just tried your code but it doesn't give me any info and if I try to include the link.html I get no more details than before. What I don't understand is that I'm searching to provide basic info about the link for which there are no reviews. The only value there is on the page is "$ID" that I used above to query the database about the Title of the link. I can then use the Title of the link to generate the mod_rewrite urls.

However I was thinking that to carry on in this same way that I could, at the same time, query the database about the ischanged, isnew and ispopular.

BTW what is the point of setting the ID with
<%set ID = $ID%>

since the ID is the one thing that is available and can be used to check with regards to the link ?

Thanks,

John
Significant Media
Quote Reply
Re: [Jag] review_search_results.html error handling In reply to
Oh yeah, load_link_info won't actually fetch the link info, you'll have to do it yourself before hand. What load_link_info will do is setup isNew, isChanged, etc, and payment expiry tags.

Adrian
Quote Reply
Re: [Jag] review_search_results.html error handling In reply to
I figured out how to fix this using a global to get all link info like Adrian suggested. The <%Links::Utils::load_link_info%> and <%include link.html%> then format the information nicely.

John
Significant Media