#!/usr/bin/perl use strict; my @topics = qw(Home Bio Haley Ursula Cal Blues Blues/Videos Shirts Contact Testimonials Mailing-List Blues-Cal); my @build_topics = qw(Special Classes Videos/youtube Ursula Contact/Rider); sub write_file { my ($which) = @_; my $file = "$which/index.html"; close(STDOUT); open(STDOUT,">$file") || die("Couldn't write file [$file]\n"); } sub cat { my ($file) = @_; open(CON,"<$file") || die("Couldn't read file [$file]\n"); while () { print; } close(CON); } sub header { my ($which) = @_; # Create list o' topic links my @tops; foreach my $topic ( @topics ) { my $name = $topic; $name =~ s/-/ /g; $name = "Travel Calendar" if $topic eq "Cal"; my $url = "/$topic/"; $url = "/" if $topic eq "Home"; $name = "Booking" if $topic eq "Contact"; #$name = "Workshops" if $topic eq "Classes"; $name = "What is Blues?" if $topic eq "Blues"; $name = "Worldwide Events" if $topic eq "Blues-Cal"; $url = "http://BluesCal.com/?4=bluesdance.com" if $topic eq "Blues-Cal"; #$url = "http://cal.GetDave.com/" if $topic eq "Daves-Cal"; my $top = ($topic eq $which) ? $name : "$name"; $top = ($topic =~ /^(Dave|Haley|Ursula)$/) ? "$top" : "$top"; $top = pop(@tops) . "
\n" . $top if $topic eq "Blues" || $topic eq "Testimonials"; push(@tops, $top); } my $topics = join(" |\n", @tops); open(HEADER,") { s/\@TOPICS_GO_HERE/$topics/g; s/\$TOPIC/$which/g; push(@hdr,$_); } close(HEADER); print @hdr; } sub footer { my ($which) = @_; open(FOOTER,") { #cat("Promo") if s/\@PROMO// && $which eq 'Home'; print; } close FOOTER; } foreach my $topic ( @topics, @build_topics ) { print STDERR "$topic\n"; next unless (-f "$topic/txt"); write_file($topic); header($topic); cat("$topic/txt"); footer($topic); }