Do you mean a 'bookmark' sidebar on your main Links index page, rather than going to portal.cgi to view the links? If so, than it's quite simple...
off the top of my head...
add a parameter to the top of the script...
Then add this:
my $max = 5;
my @links = split /\|/, $old;
my (@display, $output);
open (LINKS, "$db_lib_path/data/links.db") or die $!;
while () {
chomp (my $record = $_);
foreach (@links) {
$record =~ /^$_\|/ or next;
my @values = split /\|/, $record;
push @display, [ @values ];
}
}
close (LINKS);
my $saved = $#display + 1;
my $links = '';
my $i = 0;
foreach (sort { ${$a}[$db_title] cmp ${$b}[$db_title] } @display) {
my %rec = &array_to_hash(0, @{$_});
$links .= &load_template ("bookmark_link.html", { %rec, %globals });
$i++;
last if ($i = $max);
}
print header();
print &load_template("bookmark_home.html", {
'saved' => $saved,
'links' => $links,
%globals
});
}That should display the first 5 saved links, alphabeticly. The code could be a little off because I've been reworking 1.0 a lot.
--Drew
Free, hot camel soup for Links hackers...
http://www.camelsoup.com
off the top of my head...
add a parameter to the top of the script...
Code:
if (param('ssi') { &ssi(); }Code:
sub ssi { my $max = 5;
my @links = split /\|/, $old;
my (@display, $output);
open (LINKS, "$db_lib_path/data/links.db") or die $!;
while () {
chomp (my $record = $_);
foreach (@links) {
$record =~ /^$_\|/ or next;
my @values = split /\|/, $record;
push @display, [ @values ];
}
}
close (LINKS);
my $saved = $#display + 1;
my $links = '';
my $i = 0;
foreach (sort { ${$a}[$db_title] cmp ${$b}[$db_title] } @display) {
my %rec = &array_to_hash(0, @{$_});
$links .= &load_template ("bookmark_link.html", { %rec, %globals });
$i++;
last if ($i = $max);
}
print header();
print &load_template("bookmark_home.html", {
'saved' => $saved,
'links' => $links,
%globals
});
}
--Drew
Free, hot camel soup for Links hackers...
http://www.camelsoup.com