Browse Source

Template file instead of header/footer.

pull/1/head
Brennen Bearnes 17 years ago
parent
commit
8d182391e6
3 changed files with 45 additions and 51 deletions
  1. +0
    -40
      footer
  2. +8
    -11
      lib/Display.pm
  3. +37
    -0
      template

+ 0
- 40
footer View File

@ -1,40 +0,0 @@
<perl>
my $output;
if ($self->title eq 'new') {
my @headers = dir_list('/home/bbearnes/p1k3.com/imgs/header', 'alpha',
'\.(jpg|png)$');
my $header_image = $headers[rand @headers];
my $LinkDump = $self->wala->print_page('LinkDump');
return <<"END_HTML";
</div> <!-- end of entries -->
<div class="linkdump" id="linkdump">
<p class="centerpiece"><img src="/imgs/header/$header_image" alt="" /></p>
<h3 style="margin-bottom: .5em;"><a href="/wala/">wala</a>::<a href="/wala/wala.pl?LinkDump">LinkDump</a></h3>
$LinkDump
<p class="rights">All original content on p1k3, unless otherwise noted, is
released to the public domain.</p>
</div> <!-- end of linkdump -->
END_HTML
} else {
return <<"END_HTML";
<p class="rights">All original content on p1k3, unless otherwise noted, is
released to the public domain.</p>
END_HTML
}
</perl>
</body>
</html>

+ 8
- 11
lib/Display.pm View File

@ -154,8 +154,7 @@ my %default = (
root_dir => 'archives', # root dir for archived files
url_root => "$0?", # root URL for building links
image_url_root => '', # same for images
header => 'header',
footer => 'footer',
template => 'template',
title => '',
title_prefix => '',
stylesheet_url => undef,
@ -164,6 +163,7 @@ my %default = (
author => undef,
description => undef,
license => undef,
content => undef,
http_header => 1,
default_entry => 'new',
@ -295,16 +295,14 @@ sub display {
return $self->feed_print() if $option eq $self->feed_alias;
$output .= $self->handle($option);
}
$self->content($output);
# Wrap entries in header/footer:
my $header;
$header .= "Content-Type: text/html\n\n" if $self->http_header;
$header .= $self->fragment_slurp($self->header);
# Wrap entries in template
my $rendered_page;
$rendered_page .= "Content-Type: text/html\n\n" if $self->http_header;
$rendered_page .= $self->fragment_slurp($self->template);
return $header
. $output
. $self->fragment_slurp($self->footer);
return $rendered_page;
}
=item handle($entry)
@ -419,7 +417,6 @@ sub recent_month {
return "$year_files[0]/$month_files[0]";
}
}


header → template View File

@ -103,3 +103,40 @@
return p( { class => 'linkbar' }, $output);
</perl>
${content}
<perl>
my $output;
my $rights = '<p class="rights">All original content on p1k3, unless otherwise noted, is
released to the public domain.</p>';
if ($self->title eq 'new') {
my @headers = dir_list('/home/bbearnes/p1k3.com/imgs/header', 'alpha',
'\.(jpg|png)$');
my $header_image = $headers[rand @headers];
my $LinkDump = $self->wala->print_page('LinkDump');
return <<"END_HTML";
</div> <!-- end of entries -->
<div class="linkdump" id="linkdump">
<p class="centerpiece"><img src="/imgs/header/$header_image" alt="" /></p>
<h3 style="margin-bottom: .5em;"><a href="/wala/">wala</a>::<a href="/wala/wala.pl?LinkDump">LinkDump</a></h3>
$LinkDump
$rights
</div> <!-- end of linkdump -->
END_HTML
} else {
return "\n$rights\n";
}
</perl>
</body>
</html>

|||||||
x
 
000:0
Loading…
Cancel
Save