Gossamer Forum
Home : Products : Links 2.0 : Customization :

Build extra page at /extra.html -- not /extra/index.html

Quote Reply
Build extra page at /extra.html -- not /extra/index.html
Hi All

I'm trying to include an extra page in the build.

The default is that the extra page ends up like this:

/extra/index.html

What I want to do is have:

/extra.html

To name the file 'extra.html', I'm gonna create a tag in links.cfg below $build_index and call it $extra_index:

$extra_index = "extra.html";

Here is the sub from nph-build:

Code:
sub build_extra_page {
# --------------------------------------------------------
# Creates an "Extra" page.

local $title_linked;

if ($build_extra_path =~ m,^$build_root_path/(.*)$,) {
&build_dir ($1);
}

$title_linked = &build_linked_title ("EXTRA");
open (EXTRA, ">$build_extra_path/$extra_index") or cgierr ("unable to open EXTRA page: $build_extra_path/$extra_index. Reason: $!");
print EXTRA &site_html_extra;
close EXTRA;
}

However, the part that I'm stuck on is how to get rid of the directory creation:

/extra/extra.html

How can I change the $build_extra_path above to just create the extra.html page without creating the directory?

/extra.html

------

Here's the sub build_dir if needed:

Code:
sub build_dir {
# --------------------------------------------------------
# Verifies that all neccessary directories have been created
# before we create the category file. Takes as input, the category
# to verify, and returns the full directory path.

my $input = shift;
my ($dir, $path) = '';
my @dirs = split /\//, $input;

foreach $dir (@dirs) {
$path .= "/$dir";
&build_check_dir ($build_root_path, $path);
if (! (-e "$build_root_path$path")) {
print "\tMaking Directory ($build_dir_per): '$build_root_path$path' ...";
if (mkdir ("$build_root_path$path", "$build_dir_per")) {;
print "Made. CHMOD ($build_dir_per) ...";
if (chmod ($build_dir_per, "$build_root_path$path")) {;
print "Done.";
}
else { print "CHMOD ($build_dir_per) failed! Reason: $!."; }
}
else { print "mkdir failed! Reason: $!."; }
print "\n";
}
}
return "$build_root_path$path";
}

Here's the sub site_html_extra from site_html_templates.pl:

Code:
sub site_html_extra {
# --------------------------------------------------------
#
&html_print_headers;
return &load_template ('extra.html', {
title_linked => $title_linked,
%globals
} );
}
[/url]

Thanks very much Smile

------------------------------------------

Last edited by:

DogTags: Jan 15, 2004, 8:10 AM
Quote Reply
Re: [DogTags] Build extra page at /extra.html -- not /extra/index.html In reply to
how about omitting this part?
Code:
if ($build_extra_path =~ m,^$build_root_path/(.*)$,) {
&build_dir ($1);
}

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [fuzzy logic] Build extra page at /extra.html -- not /extra/index.html In reply to
Too easy..........worked great Smile

I had to change the path and url in links.cfg, too.

Code:
$build_extra_path = "$build_root_path";
$build_extra_url = "$build_root_url";
$extra_index = "extra.html";

Thanks Smile

------------------------------------------