I have not been able to pull from a given LinkID in the review DB the title of the link in link DB. I have tried a thousand iterations based on get_reviews code in site_html_templates, but could use a fresh set of eyes on the problem.
Dec 28, 1999, 10:39 AM
Novice (45 posts)
Dec 28, 1999, 10:39 AM
Post #2 of 14
Views: 2924
I know there must be a better way but here is what I have.
in site_html_template add
# --------------------------------------------------------
# This routine is used to display what a link listing should look
# like.
my %rec = @_;
return &load_template ('linklisting.html', {
detailed_url => "$build_detail_url/$rec{'ID'}$build_extension",
%rec,
%globals
});
}
make a template for you title. (can include any of the resource's info, just title or linked title) If you want to include the new and pop images, you'd have to add some code above. Just look at sub site_html_link
then slap this in the cgi where you need the title
replacing the $ID with whatever variable you have for the ID num.
or $ResourceTitle = &html_link_listing (&get_record($ID));
try it and see if it will work for you. the cgi where you add this code will wave to require
require "/path/to/links.cfg";
require "$db_lib_path/db_utils.pl";
require "$db_lib_path/links.def";
require "$db_lib_path/site_html_templates.pl";
If you come up with something cleaner which just changes id # to title, I'd like the snippet of code
Thanx
------------------
http://bartour.hypermart.net
in site_html_template add
Code:
sub html_link_listing { # --------------------------------------------------------
# This routine is used to display what a link listing should look
# like.
my %rec = @_;
return &load_template ('linklisting.html', {
detailed_url => "$build_detail_url/$rec{'ID'}$build_extension",
%rec,
%globals
});
}
make a template for you title. (can include any of the resource's info, just title or linked title) If you want to include the new and pop images, you'd have to add some code above. Just look at sub site_html_link
then slap this in the cgi where you need the title
Code:
print &html_link_listing (&get_record($ID));or $ResourceTitle = &html_link_listing (&get_record($ID));
try it and see if it will work for you. the cgi where you add this code will wave to require
require "/path/to/links.cfg";
require "$db_lib_path/db_utils.pl";
require "$db_lib_path/links.def";
require "$db_lib_path/site_html_templates.pl";
If you come up with something cleaner which just changes id # to title, I'd like the snippet of code
Thanx
------------------
http://bartour.hypermart.net
Dec 28, 1999, 6:34 PM
User (431 posts)
Dec 28, 1999, 6:34 PM
Post #4 of 14
Views: 2927
OK, not as close as I thought. When I explicitly require links.def in my sub html_link_listing, the get_record works as expected since proper db_cols definitions are being built. However, by requiring links.def, a loop in my main sub terminates (e.g. gets confused with review.def and links.def). I'm kind of over my head here... to my knowledge, I can't re-require review.def, or "release" links.def. Maybe the solution is not to require links.def in the first place, and build my db_cols definitions from scratch in the sub itself... ???
<update>
I put aside the get_record solution (with troublesome double requires) and kludged together a RegEx of my Links DB. It works
, but is "hardcoded" to extract only the title... with a little more thought, perhaps it could be extended to pull out any field given the LinkID from the Review DB.
For those interested, here is the code... no link.def call required. Wherever you need to grab a title, put <%Title%> in your template and the following in the appropriate sub (in the return &load_template part).
Add the following somewhere in your site_html_template.pl file.
# --------------------------------------------------------
# This routine is used to grab a link title given a review link ID
my ($id) = @_;
%globals;
my ($title, $returntitle);
$data_file = "/explicit/path/to/your/links.db";
open (FILE,"<$data_file") or &cgierr ("Can't open review file '$data_file'. Reason: $!");
LINE: while (<FILE> ) {
if ($_ =~ m/^($id)\|(.+?)\|/mg) { $title = $2; }
}
close FILE;
$returntitle = qq~
<a class="link" href="$build_detail_url/$id$build_extension">$title</a>
<a class="link" href="$db_cgi_url/jump.cgi?ID=$id">$title</a>
~;
return $returntitle;
}
[This message has been edited by oldmoney (edited December 29, 1999).]
<update>
I put aside the get_record solution (with troublesome double requires) and kludged together a RegEx of my Links DB. It works

For those interested, here is the code... no link.def call required. Wherever you need to grab a title, put <%Title%> in your template and the following in the appropriate sub (in the return &load_template part).
Code:
Title => &get_title ($rec{'LinkID'}),Code:
sub get_title { # --------------------------------------------------------
# This routine is used to grab a link title given a review link ID
my ($id) = @_;
%globals;
my ($title, $returntitle);
$data_file = "/explicit/path/to/your/links.db";
open (FILE,"<$data_file") or &cgierr ("Can't open review file '$data_file'. Reason: $!");
LINE: while (<FILE> ) {
if ($_ =~ m/^($id)\|(.+?)\|/mg) { $title = $2; }
}
close FILE;
$returntitle = qq~
<a class="link" href="$build_detail_url/$id$build_extension">$title</a>
<a class="link" href="$db_cgi_url/jump.cgi?ID=$id">$title</a>
~;
return $returntitle;
}
[This message has been edited by oldmoney (edited December 29, 1999).]
Dec 29, 1999, 12:13 PM
Novice (45 posts)
Dec 29, 1999, 12:13 PM
Post #5 of 14
Views: 2915
Opps, posted to soon.
This worked for me when I wrote my MyLinks script but didn't work in my current project. I had the same problem you did. I was able to slightly mod yours to work in my situation. Thanx!! Now doing a search for review by a user works beautifuly. I guess i'll have to work on the "edit a review" next.
http://bartour.hypermart.net/...cgi/review.cgi?ID=11
------------------
http://bartour.hypermart.net
This worked for me when I wrote my MyLinks script but didn't work in my current project. I had the same problem you did. I was able to slightly mod yours to work in my situation. Thanx!! Now doing a search for review by a user works beautifuly. I guess i'll have to work on the "edit a review" next.
http://bartour.hypermart.net/...cgi/review.cgi?ID=11
------------------
http://bartour.hypermart.net
Dec 29, 1999, 1:04 PM
Veteran (2260 posts)
Dec 29, 1999, 1:04 PM
Post #6 of 14
Views: 2931
mutt.. you're site is pretty cool
i like what you've done with review.cgi..
but this image is TOO COOL..
http://bartour.hypermart.net/ubb/avatar/face36.gif
hehe..
jerry

i like what you've done with review.cgi..
but this image is TOO COOL..
http://bartour.hypermart.net/ubb/avatar/face36.gif
hehe..

jerry
Dec 29, 1999, 3:04 PM
Novice (27 posts)
Dec 29, 1999, 3:04 PM
Post #8 of 14
Views: 2950
Hi!
Mutt and/or Widgetz: I want to use your pretty cool mod, but I can't use the install.cgi! The LWP module use is not allowed at my provider.
Would you please be so kind and pass me your perl-scripts per email? This would be really great! Maybe as great as your scripts
Good luck for 2000
Stefan
------------------
visit Juhu!Katzen!
http://www.juhukatzen.de/
[This message has been edited by stefang (edited December 29, 1999).]
Mutt and/or Widgetz: I want to use your pretty cool mod, but I can't use the install.cgi! The LWP module use is not allowed at my provider.

Would you please be so kind and pass me your perl-scripts per email? This would be really great! Maybe as great as your scripts

Good luck for 2000
Stefan
------------------
visit Juhu!Katzen!
http://www.juhukatzen.de/
[This message has been edited by stefang (edited December 29, 1999).]
Dec 29, 1999, 10:08 PM
Veteran (2260 posts)
Dec 29, 1999, 10:08 PM
Post #10 of 14
Views: 2834
there was one post.. to i beleive someone named michelle (i don't know how i remembered that..)
anyways.. i explained what the LWP did to get the code from my site.. and gave instructions on what to do.. it's not an easy process..
i'm about to throw review.cgi v1 in the dumps and not support it any longer as review.cgi v2 for Links SQL is just about ready..
jerry
anyways.. i explained what the LWP did to get the code from my site.. and gave instructions on what to do.. it's not an easy process..
i'm about to throw review.cgi v1 in the dumps and not support it any longer as review.cgi v2 for Links SQL is just about ready..
jerry
Sep 10, 2000, 7:32 PM
User (431 posts)
Sep 10, 2000, 7:32 PM
Post #13 of 14
Views: 2811
Hi... not on the boards here too much these days, but by sheer coincidence, I saw your post. You really won't need to implement the code I showed earlier unless you are customizing how Links works with Widegetz' Review mod. The best advice I can give you is that the title definition will need to be called where ever you are calling on the Review mod (for example, pulling new reviews into What's New).
Sep 11, 2000, 6:07 AM
User (60 posts)
Sep 11, 2000, 6:07 AM
Post #14 of 14
Views: 2814
I have tried to use this mod to add the title into the email message the reviewer gets. I thus inserted the sub into the bottom of the admin_html.cgi file and the other bit into the &load_template refering to the review-add.txt file. Then when a review is validated the email has this in it:
HASH(0xe93c04)
I think my error is in this bit, let me know if I have done something wrong:
Title => &get_title ($rec{'LinkID'})
});
HASH(0xe93c04)
I think my error is in this bit, let me know if I have done something wrong:
Code:
my $msg = &load_template ('review-add.txt', \%link, { Title => &get_title ($rec{'LinkID'})
});