I don't know if you have figured this out, James....But I have...and the instructions posted by Jerry are bit incomplete for most novice programmers...
Here is what I did....(works in Links SQL 1.11):
1) Add the following text in the
@EXPORT = qw/ section:
Code:
&site_html_jump_display &site_html_jump_error 2) Add the following subs in your
HTML_Templates.pm file:
Code:
sub site_html_jump_display {
#---------------------------------------------------------
# Top Frame for Jump.cgi
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 ('jump_display.html', {
%$tags,
%GLOBALS
}, undef, $template);
defined $dynamic and &clean_output($dynamic, \$output);
print $output;
} AND
Code:
sub site_html_jump_error {
#---------------------------------------------------------
# Error Page for jump.cgi
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 ('jump_error.html', {
%$tags,
%GLOBALS
}, undef, $template);
defined $dynamic and &clean_output($dynamic, \$output);
print $output;
} Note: You do not have to add the second sub-routine...you can use
sub site_html_error instead.
3) Create two new template files:
jump_display.html and
jump_error.html. If you chose not to add the second sub above, then you do not need to create the second template file. The
jump_display.html can contain the following:
a) Rate Form
b) Links to other interactive options
c) Link to Category Page using the following codes and tags:
Code:
<a href="<%build_root_url%>/<%Category%>/">Category Page</a> 4) Then in the
jump.cgi file, change the following codes, add the following codes in the
load modules section:
Code:
use Links;
use HTML_Templates; Note: I have put my modules in a different directory and I am using the following codes:
Code:
use Links::Links;
use Links::HTML_Templates; But if you are using the default structure of
Links SQL, you should be fine with the first set of module codes.
5) Add the following codes in the
jump.cgi file:
Code:
print $in->header('text/html'); in the
sub main routine before the
my... codes.
6) Then replace the following codes in the
sub main routine in the
jump.cgi file:
Code:
my ($db, $id, $sth, $total, $rec, $offset, $goto, $track, $update); with the following codes:
Code:
my ($db, $id, $sth, $total, $rec, $offset, $goto, $track, $update, $category, $name); 7) Then add the following set of codes:
Code:
elsif ($in->{'display'}) {
$rec = $db->get_record($id, 'HASH');
$rec or &Links::DBSQL::cgierr ("Can't find link ID: $id");
$category = $rec->{'CategoryID'};
$name = &get_category_name ($category);
&site_html_jump_display ({Category => $name}, $dynamic);
exit;
} BEFORE the following codes:
Code:
# Otherwise, if we have a link, let's look it up.
elsif (defined $id) { 8) Then replace the following codes (as Widgetz/jerrysu provided before):
Code:
$goto ? print $in->redirect ($goto) : return &error ("Record not found: $id"); to the following codes:
Code:
print qq~
<html>
<head>
<title>${$rec}{'Title'}</title>
</head>
<frameset rows="100,*" frameborder="0" border="0" frameborder="no" border="no" framespacing="0">
<frame name="top" src="$LINKS{build_jump_url}?ID=$id&display=1" marginwidth="0" marginheight="0" scrolling="no" frameborder="no">
<frame name="bottom" src="$goto" marginwidth="0" marginheight="0" scrolling="auto" frameborder="no">
<noframes>
<body>
~;
$goto ?
print "Go to: <a href=\"$goto\">${$rec}{'Title'}</a>\n\n" :
&error ("Record not found: $id)");
print qq~
</body>
</noframes>
</frameset>
</html>~; Note: As widgetz/jerrysu noted, if you are using the default version of
jump.cgi, you should change the
return to
print.
That should do it...
Note: Remember the error subs I referred to above...well, you can replace all occurrences of
&error with
&site_html_error OR
site_html_jump_error depending whether or not you added the new sub or not.
Man...Links SQL is fun.
Hope this helps.
Regards,
Eliot