Hi Glennu,
first i want to say Thank you for writing this nice script. :)
But I have a problem. The Subcats are not shown on the main page.
http://www.revierloewenfans.de/links
I donīt find an error... checked your description three times
---
categories.db
2|REVIERLOEWEN|Alle Links haben die Eishockey-Nr. 1 im Pott als Thema.||||||
3|DEL|||||||
4|DEB|Alles aus dem Bereich des Deutschen Eishockey-Bundes.||||||
7|Augsburger_Panther|||||||DEL
ID 7 should be a subcat from DEL (ID 3)
---
category.def
# Database Definition: CATEGORIES
# --------------------------------------------------------
# Definition of your database file.
%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Name => [1, 'alpha', 40, 75, 1, '', '^[\w\d/_-]+$'],
Description => [2, 'alpha', '40x3', 500, 0, '', ''],
Related => [3, 'alpha', 0, 255, 0, '', ''],
'Meta Description' => [4, 'alpha', 40, 75, 0, '', ''],
'Meta Keywords' => [5, 'alpha', 40, 75, 0, '', ''],
Header => [6, 'alpha', 40, 75, 0, '', ''],
Footer => [7, 'alpha', 40, 75, 0, '', ''],
Subcats => [8, 'alpha', 0, 255, 0, '', '']
);
---
site_html_templates
my (@subcat) = @_;
my ($url, $numlinks, $mod, $subcat, $category_name, $description, $output, $i);
my ($half) = int (($#subcat+2) / 2);
# Print Header.
$output = qq|<div class="margin"><table width="80%" border="0" cellspacing="0" cellpadding="0"><tr><td class="catlist" valign="top">\n|;
foreach $subcat (sort @subcat) {
($description) = @{$category{$subcat}}[2];
my ($subcats) = @{$category{$subcat}}[8];
@subcats = split(/\Q$db_delim\E/, $subcats); $subcats = "";
foreach $scat (@subcats) {
$subcats .= qq|<a href="$build_root_url/|;
$subcats .= &urlencode($scat);
$subcats .= qq|/$build_index">|;
if ($scat =~ m,.*/([^/]+)$,) { $subcats .= &build_clean($1);}
else {
$subcats .= &build_clean($scat);
}
$subcats .= qq|</a> |;
}
# First let's get the name, number of links, and last modified date...
$url = "$build_root_url/" . &urlencode($subcat) . "/";
if ($subcat =~ m,.*/([^/]+)$,) { $category_name = &build_clean($1); } else { $category_name = &build_clean($subcat); }
$numlinks = $stats{"$subcat"}[0];
$mod = $stats{"$subcat"}[1];
# We check to see if we are half way through, if so we stop this table cell
# and begin a new one (this lets us have category names in two columns).
if ($i == $half) {
$output .= qq|</td><td class="catlist" valign="top">\n|;
}
$i++;
# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<dl><dt><strong><a class="link" href="$url">$category_name</a></strong> <small class="numlinks">($numlinks)</small> |;
$output .= qq|<small><sup class="new">new</sup></small>| if (&days_old($mod) < $db_new_cutoff);
$output .= qq|</dt>|;
$output .= qq|<dd><span class="descript">$description
$subcats</span></dd>| if (!($description =~ /^[\s\n]*$/));
$output .= qq|</dl>|;
}
# Don't forget to end the unordered list..
$output .= "</td></tr></table></div>\n";
return $output;
}
1;
---
db_utils.pl
$db_select_fields{'Mult-Subcats'} = join (",", &category_list);
if (! exists $db_select_fields{$column}) {
$db_select_fields{$db_cols[$db_category]} = $db_select_fields{'Mult-Related'} = join (",", &category_list);
}
---
Do you find an error? Many Thanks in advance for your time!
joergh