Gossamer Forum
Home : Products : Links 2.0 : Customization :

variables on rate success

Quote Reply
variables on rate success
I'm trying to use the template variables to show the name of the link rated by the visitor (i.e. "Your rating for <%Title%> was received"). All I get is:

Unkown tag: Title

This is the same variable used on many other pages...any idea why it won't work here or am I just missing something stupid?


PS: Alex--note the typo for your release version.
Quote Reply
Re: variables on rate success In reply to
I just discovered I was getting the same error earlier yesterday. I fixed it by adding:

Quote:
<input type=hidden name="Title" value="<%Title%>">

right after the <form> tag in the template file, rate.html

I hope this helps.
Quote Reply
Re: variables on rate success In reply to
Brad,

Thanks for that information. I am off to edit my site_html_templates.pl right now and will do the same for sub site_html_rate_failure too! Smile

By the way, I made another change to sub site_html_rate_form. Under my %rec = @_; I added:

Quote:
my $returnto = $ENV{'HTTP_REFERER'};

Then I added:

Quote:
returnto => $returnto,

to the load rate.html block. Now I can use <%returnto%> in the rate_success.html and rate_error.html files to allow the person doing the rating to return to the page containing the link they rated.


[This message has been edited by Bobsie (edited March 04, 1999).]
Quote Reply
Re: variables on rate success In reply to
Thanks Bobsie. I actually learned a better way to make this work (and forgot to update my post) while doing the template mod for the remote rating script (see www.gossamer-threads.com/scripts/forum/resources/Forum3/HTML/000767.html

If you add %rec, to sub site_html_rate_success in site_html_templates.pl you can pass any of the variables to the success page without adding a bunch of hidden tags.
Here's a cut and paste variety for anyone who's interested:

Code:
sub site_html_rate_success {
# --------------------------------------------------------
# This routine determines how the rate success page will look like.

&html_print_headers;
print &load_template ('rate_success.html', {
%rec,
%in,
%globals
});
}
Quote Reply
Re: variables on rate success In reply to
Hi Bobsie,

How did you manage to get the actual page to print out? I keep getting the url of the previous page showing up. For example "http://www.thelaboroflove.com/websearch/links2/rate.cgi?ID=1770" instead of the page address that the started from.

Can you help me out here??

Thanks alot! Smile
Vickie
Quote Reply
Re: variables on rate success In reply to
I've had problems with HTTP_REFERER as well which is why I chose the following route instead. Not sure what works for site_html_templates.pl users.

In rate.html (just below the line that starts the same way) add
Code:
<input type=hidden name="Category" value="<%Category%>">
In rate_success.html (and failure) add
Code:
<a href="<%build_root_url%>/$in{'Category'}/">Return to $in{'Category'}</a>
Or maybee it should be (if I read Bobsie right) the following
Code:
<a href="<%build_root_url%>/<%Category%>/">Return to <%Category%></a>

Non template user with foot in mouth.

[This message has been edited by Dave (edited April 21, 1999).]
Quote Reply
Re: variables on rate success In reply to
 Smile

Arggghhh!

I am totally lost!

David the things that you said to input look like they actually belong in the template files, rate.html and rate_success.html but am not totally sure. Do they belong in the site_html_templates.pl? If so could you let me know exactly where they belong?? For example what the line above or below should read.

Thanks for your patience!
Vickie
Quote Reply
Re: variables on rate success In reply to
Vickie,

Each links in a category page has a hyperlink to "Rate It" which brings up the Rate Form on a separate page using sub site_html_rate_form in site_html_templates.pl. Here is how that subroutine looks on my system:

Code:
sub site_html_rate_form {
# --------------------------------------------------------
# This routine determines how the rate form page will look like.
#
my %rec = @_;
my $returnto = $ENV{'HTTP_REFERER'};

&html_print_headers;
print &load_template ( 'rate.html', {
ReturnTo => $returnto,
%rec,
%globals
});
}

Since they only arrive at the Rate It page from one of my category pages, $ENV{'HTTP_REFERER'} will always point back to that category page since that is where the person came from.

Then, in the actual form in rate.html, I have this line:

Quote:
<input type=hidden name="ReturnTo" value=<%ReturnTo%>">

That causes the variable 'ReturnTo' to be passed to rate.cgi as part of the form and, subsequently, to the sub site_html_rate_success in site_html_templates.pl (it is part of the %in variable at that point and the %in variable is passed to the rate_success.html template file by the subroutine.

In rate_success.html, I then use the following line:

Quote:
<a href="<%ReturnTo%>">Return to Original Page</a>

Any form field name is available in the template (as part of the %in variable passed to it) directly as shown. I do not need to even tell it which passed variable to use, I just use the name I gave it in the original form.

I hope this is clearer now.

[This message has been edited by Bobsie (edited April 21, 1999).]
Quote Reply
Re: variables on rate success In reply to
Vickie,

Sorry I'm not a template user and I didn't change enough things. I revised the post above but no guarantee, Bobsie's da man...except when he leaves in other customization.

Hey Bobsie,

What's that CatNbr stuff in your sub site_html_rate_form quote. Smile

[This message has been edited by Dave (edited April 21, 1999).]
Quote Reply
Re: variables on rate success In reply to
Dave,

Okay, I corrected the code. $CatNbr was something I use for my Link Exchange code. I also corrected my spelling of Vickie's name.

Quote:
I wanted to see how your method works but something's busted over there.

Over where? On my site? Where did you go and what is broken?
Quote Reply
Re: variables on rate success In reply to
Bobsie,

I guess I was editing while you were replying. I'm an exception to the norm in that I have referrer logging turned off, with referrer logging turned on your Return to Original Page link works fine.
Quote Reply
Re: variables on rate success In reply to
Thanks Dave. You really had me worried there for a while.

Anyway, the $CatNbr thingymebopper...

I am a member of Link Exchange and I have it setup to use multiple pages. Well, if you know anything about Link Exchange, you know that for multiple pages, you put in the following type of url:

Quote:
<a href="http://ad.linkexchange.com/***/X964367/gotoad.map" target="_top">

where the "***" represents the number of the page being loaded. In my site menu, I have 9 options, 7 of which are Links generated, 1 is a separate guestbook script, and of course, the basic Birdcast Recommend this page (not link) script.

In each site_html_templates.pl subroutine that loads a template file for the menu options, I hardcode a number to be used in place of the "***" in the above code and pass it to the template.

I also do the same in the sub site_html_category routine but, in this case, I need to calculate the page number, offset from 10 (one more than the 9 options because my site menu does not include a hyperlink to the home page). So, in that subroutine, I put:

Quote:
my $CatNbr = $category{$category_name}[0] + 10;

This gives me a unique number to use for each category or subcategory page that I can pass to the category template files to plug into the Link Exchange code. In the template files, I just include the following code:

Quote:
<!-- BEGIN INTERNET LINK EXCHANGE CODE -->
<a href="http://ad.linkexchange.com/<%catnbr%>/X964367/gotoad.map" target="_top">
<img width=440 height=40 border=1 ismap alt="Internet Link Exchange" src="http://ad.linkexchange.com/<%catnbr%>/X964367/logoshowad?free"></a><br>
<font size=1><a href="http://www.linkexchange.com/" target="_top">Member of the Internet Link Exchange</a></font><br>
<!-- END INTERNET LINK EXCHANGE CODE -->

Does that answer your question?



[This message has been edited by Bobsie (edited April 22, 1999).]
Quote Reply
Re: variables on rate success In reply to
Any ideas on how to make the $CatNbr (or similar) variable work for using Link Exchange on detailed pages (using templates)?

Thanks
Quote Reply
Re: variables on rate success In reply to
Pick a number (ending with zero) that is at least one higher than the highest you already use, for example, 90, 100, or 200. That will ensure you do not duplicate directory numbers for the Link Exchange code.

Then, in site_html_templates.pl, sub site_html_detailed, put:

Quote:
my $CatNbr = 200 + $rec{'ID'};

In the list of variables for the template, add:

Quote:
CatNbr => $CatNbr,

and use <%CatNbr%> in the detailed.html template with the Link Exchange code.

I hope this helps.