Gossamer Forum
Quote Reply
Help with Keyword Global
I'm using this global for the top 100 keywords

sub {
my (@output,$db,$sth);
$db = $DB->table('SearchLog');
$db->select_options ('ORDER BY HitCount DESC', 'LIMIT 100');
$sth = $db->select;
while (my $row = $sth->fetchrow_hashref) {
push @output, qq~<li><a href="$CFG->{db_cgi_url}/search.cgi?query=$row->{Term}">$row->{Term}</a>~;
}
return $#output > -1 ? join('<br>', @output) : 'No terms yet!';
}

It currently lists the keywords in 1 column with bullets.

How Can I get this to list the keywords in 2 columns and by number? 1 2 3...100

Thanks,

Craven
Quote Reply
Re: [craven32] Help with Keyword Global In reply to
To change to a numbered list put <ol> </ol> around the global tag.

To put into more than one column try this (put the global tag within <table><tr><td> ... </td></tr></table> tags):

sub {
my (@output,$db,$sth);
$db = $DB->table('SearchLog');
$db->select_options ('ORDER BY HitCount DESC', 'LIMIT 100');
$sth = $db->select; my $i=0;
while (my $row = $sth->fetchrow_hashref) {
$i++;
if ($i == 50){
push @output, qq~<li><a href="$CFG->{db_cgi_url}/search.cgi?query=$row->{Term}">$row->{Term}</a></td><td>~;
} else {
push @output, qq~<li><a href="$CFG->{db_cgi_url}/search.cgi?query=$row->{Term}">$row->{Term}</a>~;
}
}
return $#output > -1 ? join('<br>', @output) : 'No terms yet!';
}
Quote Reply
Re: [afinlr] Help with Keyword Global In reply to
Almost there! Now it's showing the first 50 keywords 1 - 50 but the others are not numbered, just bullets
Quote Reply
Re: [craven32] Help with Keyword Global In reply to
Oh yes - you'll need to change the </td><td> to </ol></td><td><ol>
Quote Reply
Re: [afinlr] Help with Keyword Global In reply to
I tried that earlier and both columns were numbered 1 through 50. Anyway to get it so that it would be 1 - 100?

I've been toying around with it but can't seemed to get the right combination.

Craven
Quote Reply
Re: [craven32] Help with Keyword Global In reply to
Try changing <li> in the global to $i