Home : Products : Links 2.0 : Discussions :

Products: Links 2.0: Discussions: Re: [hairy] Adding to a design template: Edit Log

Here is the list of edits for this post
Re: [hairy] Adding to a design template
OK, but it takes a bit...

In link.cfg, you need both of these:

$build_index = "index.html";
$build_index1 = "index1.html";


In site_html_templates.pl, paste the sub below under the existing sub site_html_home:



sub site_html_home1 {
# --------------------------------------------------------
# This routine will build a home page. It is not meant to have any
# links on it, only subcategories.

return &load_template ('home1.html', {
category => $category,
grand_total => $grand_total,
%globals
});
}

Make sure the name of the template matches what you have in the template directory. Next, in nph-build.cgi, under sub build_all, paste this under the current Create Home Page:

# Create Home Page1
$use_html ?
print qq|Building <A HREF="$build_root_url/$build_index">Home Page1</A> . . .\n| :
print qq|Building Home Page1 . . .\n|;
&build_home_page1;
print "\tDone\n\n";

Further down in nph-build, paste this sub under the existing sub build_home_page:

sub build_home_page1 {
# --------------------------------------------------------
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_index1\n";

open (HOME, ">$build_root_path/$build_index1") or &cgierr ("unable to open home page: $build_root_path/$build_index1. Reason: $!");
$category = &site_html_print_cat (@rootcat) if ($#rootcat >= 0);
$total = $grand_total;
print HOME &site_html_home1;
close HOME;
print "\tClosing page.\n";
}

That should pretty much do it... As always, make sure you have a backup of everything... Ya know, it would probably be easier to just copy your whole Links script into a file names Links2, change the names in links.cfg to match that, and practice your mods using that...


Leonard
aka PerlFlunkie

Last edited by:

PerlFlunkie: Nov 21, 2003, 9:44 AM

Edit Log: