Hi
here is a list of some useful globals hope you will like:
1- Meta keywords: Will generate a keyword meta tag for each category by spliting its name..
sub {
my $vars = shift;
my $cat = $vars->{category_name};
$cat =~ s|/|, |g;
return $cat;
}
Meta keywords: Will generate a keyword meta tag for each category by its sub cats..
sub {
my $vars = shift;
my $categories = $vars->{category_loop};
my $cat = join(", ", map { $_->{Name} } @$categories);
return $cat;
}
Random Link:
sub {
my $db = $DB->table('Links');
my $total = $db->count ( 'isValidated' => 'Yes' );
my $rand = int( rand($total) );
$db->select_options ("LIMIT $rand, 1");
my $link = $db->select->fetchrow_hashref;
my $html = Links::SiteHTML::display('link', $link);
return $html;
}
Category list:
sub {
my $tags = shift;
my $cat_db = $DB->table('Category');
$cat_db->select_options("ORDER BY Full_Name");
my @root_cats = $cat_db->select (['Full_Name'])->fetchall_list;
my $output;
foreach my $root_cat (@root_cats) {
my $url = $cat_db->as_url($root_cat);
$output .= qq~<option value="$root_cat">$root_cat~;
}
return $output;
}
Last searched words:
sub {
my ($output,$db,$sth);
my $db = $DB->table('SearchLog');
$db->select_options ('ORDER BY TS DESC', 'LIMIT 5');
$sth = $db->select;
while (my $row = $sth->fetchrow_hashref) {
$output .= qq~* <a href="$CFG->{db_cgi_url}/search.cgi?query=$row->{Term}">$row->{Term}</a><br>~;
}
return $output > -1 ? join('-', $output): 'No terms yet!';
}
Newest Links:
sub {
# Displays the newest links on the home page.
my ($output,$sth,$link);
my $search_db = $DB->table('Links');
$search_db->select_options ('ORDER BY Add_Date DESC Limit 7');
$sth = $search_db->select ( { isNew => 'Yes', isValidated => 'Yes' });
while ($link = $sth->fetchrow_hashref) {
if (length $link->{Title} > 20) {
$link->{Title} = substr($link->{Title}, 0, 20) . '...';
}
$output .= Links::SiteHTML::display ('link1', $link);
}
return $output;
}
Total number of hits:
sub {
my ($total) = $DB->table('Links')->select(['SUM(Hits)'])->fetchrow_array;
return $total;
}
Top cats in a drop down menu:
sub {
my $tags = shift;
my $cat_db = $DB->table('Category');
$cat_db->select_options("ORDER BY Full_Name");
my @root_cats = $cat_db->select (['Full_Name'], { FatherID => 0 })->fetchall_list;
my $output;
foreach my $root_cat (@root_cats) {
my $url = $cat_db->as_url($root_cat);
$output .= qq~<OPTION VALUE="$CFG->{build_root_url}/$url">$root_cat~;
}
return $output;
}
Top search words:
sub {
my ($output,$db,$sth);
my $db = $DB->table('SearchLog');
$db->select_options ('ORDER BY HitCount DESC', 'LIMIT 5');
$sth = $db->select;
while (my $row = $sth->fetchrow_hashref) {
$output .= qq~* <a href="$CFG->{db_cgi_url}/search.cgi?query=$row->{Term}">$row->{Term}</a><br>~;
}
return $output > -1 ? join('-', $output): 'No terms yet!';
}
Enjoy
Regards
KaTaBd
Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
here is a list of some useful globals hope you will like:
1- Meta keywords: Will generate a keyword meta tag for each category by spliting its name..
sub {
my $vars = shift;
my $cat = $vars->{category_name};
$cat =~ s|/|, |g;
return $cat;
}
Meta keywords: Will generate a keyword meta tag for each category by its sub cats..
sub {
my $vars = shift;
my $categories = $vars->{category_loop};
my $cat = join(", ", map { $_->{Name} } @$categories);
return $cat;
}
Random Link:
sub {
my $db = $DB->table('Links');
my $total = $db->count ( 'isValidated' => 'Yes' );
my $rand = int( rand($total) );
$db->select_options ("LIMIT $rand, 1");
my $link = $db->select->fetchrow_hashref;
my $html = Links::SiteHTML::display('link', $link);
return $html;
}
Category list:
sub {
my $tags = shift;
my $cat_db = $DB->table('Category');
$cat_db->select_options("ORDER BY Full_Name");
my @root_cats = $cat_db->select (['Full_Name'])->fetchall_list;
my $output;
foreach my $root_cat (@root_cats) {
my $url = $cat_db->as_url($root_cat);
$output .= qq~<option value="$root_cat">$root_cat~;
}
return $output;
}
Last searched words:
sub {
my ($output,$db,$sth);
my $db = $DB->table('SearchLog');
$db->select_options ('ORDER BY TS DESC', 'LIMIT 5');
$sth = $db->select;
while (my $row = $sth->fetchrow_hashref) {
$output .= qq~* <a href="$CFG->{db_cgi_url}/search.cgi?query=$row->{Term}">$row->{Term}</a><br>~;
}
return $output > -1 ? join('-', $output): 'No terms yet!';
}
Newest Links:
sub {
# Displays the newest links on the home page.
my ($output,$sth,$link);
my $search_db = $DB->table('Links');
$search_db->select_options ('ORDER BY Add_Date DESC Limit 7');
$sth = $search_db->select ( { isNew => 'Yes', isValidated => 'Yes' });
while ($link = $sth->fetchrow_hashref) {
if (length $link->{Title} > 20) {
$link->{Title} = substr($link->{Title}, 0, 20) . '...';
}
$output .= Links::SiteHTML::display ('link1', $link);
}
return $output;
}
Total number of hits:
sub {
my ($total) = $DB->table('Links')->select(['SUM(Hits)'])->fetchrow_array;
return $total;
}
Top cats in a drop down menu:
sub {
my $tags = shift;
my $cat_db = $DB->table('Category');
$cat_db->select_options("ORDER BY Full_Name");
my @root_cats = $cat_db->select (['Full_Name'], { FatherID => 0 })->fetchall_list;
my $output;
foreach my $root_cat (@root_cats) {
my $url = $cat_db->as_url($root_cat);
$output .= qq~<OPTION VALUE="$CFG->{build_root_url}/$url">$root_cat~;
}
return $output;
}
Top search words:
sub {
my ($output,$db,$sth);
my $db = $DB->table('SearchLog');
$db->select_options ('ORDER BY HitCount DESC', 'LIMIT 5');
$sth = $db->select;
while (my $row = $sth->fetchrow_hashref) {
$output .= qq~* <a href="$CFG->{db_cgi_url}/search.cgi?query=$row->{Term}">$row->{Term}</a><br>~;
}
return $output > -1 ? join('-', $output): 'No terms yet!';
}
Enjoy
Regards
KaTaBd
Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory