OK Glennu this is what I done with sub..# Build Top Category Featured Links.
# -----------------------------------------------------------
sub build_featured_links{
$num_random_links = 5;
foreach $category (@{$random_links{$category}}){
if (($numlinks > ($num_random_links + 10)) and ($category_name =~ m,.*/([^/]+)$,)){
$link_output = "";
for ($r = 0; $r < $num_random_links; $r++) {
# Get the random line from the url lookup database.
$find = 0; $rand = int (rand ($numlinks + 0.5));
($rand == $numlinks) and ($rand--);
LINK: for ($i = 0; $i < $numlinks; $i++) {
#last LINK if ($tmp{$db_key} eq "");
$find++ == $rand or next;
$c = 0;
foreach $set (@visited) {
if ($rand == $set){
$c++;
}
}
if ($c == 0){
push (@visited, $rand);
%tmp = &array_to_hash ($i, @{$random_links{$category}});
$link_output .= &site_html_link (%tmp) . "\n";
}
else {
$r = $r - 1;
}
}
last;
}
}
}
# Create the random links page.
open (CAT, ">$dir/randomlinks.txt") or &cgierr ("unable to open category page: $dir/randomlinks.txt: $!");
print CAT "$link_output";
close CAT;
}
# ------------------------------------------------------------------------
# Finnish of Top Category Featured Links.
No erors come up..but it doesn't build anything either as in nothing..problem something I have done or haven't done..but I am at a lose to no what..
Admittedlamb.
# -----------------------------------------------------------
sub build_featured_links{
$num_random_links = 5;
foreach $category (@{$random_links{$category}}){
if (($numlinks > ($num_random_links + 10)) and ($category_name =~ m,.*/([^/]+)$,)){
$link_output = "";
for ($r = 0; $r < $num_random_links; $r++) {
# Get the random line from the url lookup database.
$find = 0; $rand = int (rand ($numlinks + 0.5));
($rand == $numlinks) and ($rand--);
LINK: for ($i = 0; $i < $numlinks; $i++) {
#last LINK if ($tmp{$db_key} eq "");
$find++ == $rand or next;
$c = 0;
foreach $set (@visited) {
if ($rand == $set){
$c++;
}
}
if ($c == 0){
push (@visited, $rand);
%tmp = &array_to_hash ($i, @{$random_links{$category}});
$link_output .= &site_html_link (%tmp) . "\n";
}
else {
$r = $r - 1;
}
}
last;
}
}
}
# Create the random links page.
open (CAT, ">$dir/randomlinks.txt") or &cgierr ("unable to open category page: $dir/randomlinks.txt: $!");
print CAT "$link_output";
close CAT;
}
# ------------------------------------------------------------------------
# Finnish of Top Category Featured Links.
No erors come up..but it doesn't build anything either as in nothing..problem something I have done or haven't done..but I am at a lose to no what..
Admittedlamb.