#!/usr/bin/perl # # New Version of the Subtext. Gets rid of that unweildy navigation # and automates printing of the latest episode # use strict; my $basedir = "/opt/webdocs/farmertan/subtext"; my $indexfile = "subtext.index"; my $template = "template.html"; my ($year,$month,$day); my @months = ('Extras', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); #($ENV{REQUEST_METHOD} eq "GET") || exit; # read index open (INDEXFILE, "$basedir/$indexfile"); my @index = ; close (INDEXFILE); # Get the Latest my $max = scalar(@index) - 1; my ($latestnum,$latestfile) = split /::/, $index[$max]; my $requested; if ($ENV{QUERY_STRING} =~ /^\d+$/) { $requested = $ENV{QUERY_STRING}; if ($requested > $latestnum) { $requested = $latestnum; } } else { $requested = $latestnum; } print "Content-type: text/html\n\n"; my $file; my $filenum; my $subtextfile; my $previous; my $next; if ($requested eq $latestnum) { $subtextfile = $latestfile; $previous = $latestnum - 1; $next = ""; } else { foreach (@index) { my ($filenum,$file) = split /::/; if ($requested eq $filenum) { $subtextfile = $file; $previous = $filenum - 1; $next = $filenum + 1; } } } my ($prevlink,$nextlink); if ($previous > 0) { $prevlink = "Previous Subtext"; } if ($next) { $nextlink = "Next Subtext"; } ($year,$month,$day) = split /\//, $subtextfile; $day =~ s/^(.+)\.html/$1/; my $date = "$months[$month] $day, $year"; open (SUBTEXT, "$basedir/$subtextfile"); my @subtext = ; #while () {print;} close (SUBTEXT); #Pick a title image my $title; my $titledir = "titles"; my @titlelist = ""; # Open the banner directory - put gif and jpg files into an array of banners opendir(TITLEDIR, "$basedir/$titledir"); while (defined($title=readdir(TITLEDIR))) { ($title =~ /jpg|gif/) && push @titlelist, $title; } closedir(TITLEDIR); # get the number of banners my $titlecount = scalar(@titlelist) - 1; # pick one randomly srand; my $rnum = int(rand($titlecount) + 1); # Print it all out $title = "/subtext/titles/$titlelist[$rnum]"; print < Farmertan Subtext - $date

$date
Subtext Fun!
$prevlink $nextlink

  @subtext
$nextlink



Farmertan.com
All Content ©2000 M.Schamis
home | polltime | subtext | comment.
EOSUBTEXT