Gossamer Forum
Home : Products : Links 2.0 : Customization :

If statment (for reviews) in link.html

Quote Reply
If statment (for reviews) in link.html
Hi, I'm wanting to add an if statement in my link.html file to show a see reviews button if a link has reviews and not show it if it doesn't. Here is my link.html and where I want to add the if statment:

Code:
<ul><li>
<a class="link" href="<Û_cgi_url%>/jump.cgi?ID=<%ID%>"><%Title%></a>
<%if Description%>
- <Þscription%> 
<%endif%>
<%if isNew%>
<small class="new">new</small>
<%endif%>
<%if isPopular%>
<small class="pop">cool</small>
<%endif%>

<small class="date">(Added: <Úte%> Hits: <%Hits%> Rating: <%Rating%>
<%if bla%>
<a href="<Û_cgi_url%>/review.cgi?ID=<%ID%>">[Reviews]</a>
<%endif%>
Votes: <%Votes%> ) <a href="<Û_cgi_url%>/review.cgi?ID=<%ID%>">Rate It</a> / <a href="<Û_cgi_url%>/sendlink.cgi?ID=<%ID%>">Recommend</a> / <a href="<Û_cgi_url%>/deadlink.cgi?ID=<%ID%>">Dead Link</a></small>
</ul>
I know you need to to edit some other files in order to do this, I don't know which. I'm just a beginner at PERL (I've made a simple jukebox Smile). Help will be greatly appreciated.

Thanks,
YellowKard
Quote Reply
Re: If statment (for reviews) in link.html In reply to
First of all, you would not be as easy as you think to do this....and it would take some time for me to help with the exact codes that you need...but here is the logic:

1) Add a new field to your links.def file called isReviewed. This would be a Yes/No select field and you can read about adding this type of field in the isDetailed Threads found throughout this forum and also read the FAQ about adding new fields.

2) Then you would have to add a sub in the nph-build.cgi file that updates this field based on IDs found in the review.db file.

3) Then you would be able to the following conditional codes in your link.html file:

<%if isReviewed%>
<a href="<Û_cgi_url%>/review.cgi?ID=<%ID%>">[Reviews]</a>
<%endif%>

Yet after looking at your codes, I don't know why you want to do this since you already are linking to the review.cgi via the Rate It link...unless you are using the code hack to the Review.cgi Mod that allows you to add a review NOT in the main review_form.html page, but in a separate page.

What is your goal for doing this if you already have a link to the review.cgi via the Rate It! link???

Regards,

Eliot Lee
Quote Reply
Re: If statment (for reviews) in link.html In reply to
In Reply To:
What is your goal for doing this if you already have a link to the review.cgi via the Rate It! link???
So people who are not voting on it can tell if there are reviews for it other than clicking on rate it (which people won't know that there are reviews by going here) for every link to see if they can find one with a review.

Originally I had the Rate It! link go to <Û_cgi_url%>/review.cgi?ID=<%ID%>#add, and I had a anchor in my review_form.html so it will jump down to the review form. This didn't work because it thought that the #add in the address was part of the ID number. Do you have any suggestions on that? Also please don't forget about showing me the code for the sub in the nph-build.cgi whenever a chance to do that (I know your very busy).

Thanks for the help Eliot,

YellowKard
Quote Reply
Re: If statment (for reviews) in link.html In reply to
Couple suggestions...

1) Create your Review Form to have the form on the right side of the page...like mine:

http://vlib.anthrotech.com/bin/review.cgi?ID=1139

To see how my Review page looks without reviews, go here:

http://vlib.anthrotech.com/bin/review.cgi?ID=2

2) As I mentioned, there is a code hack in this Forum that will allow you to have the reviews in the review_form.html template file, and then link to the add review form. I believe this code hack was written in the Fall of 1999. Search for add reviews form widgetz, using And search option and search ONLY in the Links 2.0 Customization Forum.

This will allow you to have two links:

<a href="<Û_cgi_url%>/review.cgi?ID=<%ID%>">Read Reviews</a>
<a href="<Û_cgi_url%>/review.cgi?ID=<%ID%>&add_form=1">Add Review</a>

Regards,

Eliot Lee