Sorry again; I am completely off track now guys. PLease help me back in track. Canany willing to tell me in details how to make it works now? Here is what I did:
1) I opened nph_build.cgi then add Alex's code in as below:
Quote:
sub build_home_page {
# --------------------------------------------------------
my ($subcat, @rootcat);
local ($total);
# Check to see which categories are off of the root.
foreach $subcat (sort keys %category) {
if ($subcat =~ m,^([^/]*)$,) {
push (@rootcat, $subcat);
}
}
print "\tSubcategories: "; print $#rootcat+1; print "\n";
print "\tTotal Links: $grand_total\n";
print "\tOpening page: $build_root_path/$build_index\n";
my $LASTX = 5;
open (DB, "<$db_file_name") or &cgierr("unable to open database:$db_file_name.\nReason: $!");
my @lines = <DB>;
close DB;
for my $i ($#lines - $LASTX .. $#lines) {
chomp $lines[$i];
@tmp = &split_decode ($lines[$i]);
%tmp = &array_to_hash (0, @tmp);
$lastlink .= &site_html_link (%tmp);
}
open (HOME, ">$build_root_path/$build_index") or &cgierr ("unable to open home page: $build_root_path/$build_index. Reason: $!");
$category = &site_html_print_cat (@rootcat) if ($#rootcat >= 0);
$total = $grand_total;
print HOME &site_html_home;
close HOME;
print "\tClosing page.\n";
}
2) Then I open site_html_tamplates.pl and added the folowing to the site_html_home routine
Quote:
sub site_html_home {
# --------------------------------------------------------
# This routine will build a home page. It is not meant to have any
# links on it, only subcategories.
return &load_template ('home.html', {
category => $category,
grand_total => $grand_total,
lastLink => $lastlink,
%globals
});
}
3) The I added <%$lastlink%> to the home.html in template.
4) I build the site. anr open the page I got Unknowtag: lastlink.
What's wrong with that? Please help me.
[This message has been edited by tim (edited September 09, 1999).]