#! /usr/bin/perl -w # ######################################## # # displays prayer page for DTN site # written by benjamin ramey # bsr@rameydesign.net # april, 2004 # ######################################## $data_file = "./data/prayer_data.txt"; print "Content-type: text/html\n\n"; &Print_Top_HTML; &Carters_Min_Cal; &Email_Updates; &Prayer_Letters; &Print_Bottom_HTML; ################################################################################################################################################ # SUB ROUTINES FOR DYNAMIC HTML ################################################################################################################################################ sub Carters_Min_Cal { my $travel_data = './data/travel_data.txt'; my $in_section = 0; my $moment_counter = 0; my $cur_date = 0; print <<"HTML";
  Carter's Ministry Calendar      
  The last six Carter's Missionary Moments
    HTML open( INFILE, $travel_data ) or print "ERROR: Could not open $travel_data."; while( (my $fl = ) && ($moment_counter <= 6) ) { if( $fl =~ m// ) { $in_section = 1; } if( $fl =~ m/<\/cartercalender>/ ) { $in_section = 0; } if( ($fl =~ m/(.*)<\/date>/ ) && $in_section ) { $cur_date = $1; } if( ($fl =~ m/(.*)<\/file>/) && $in_section ) { print "
  • $cur_date
  • \n"; $moment_counter++; } } close( INFILE ); print <<"HTML";
HTML } sub Email_Updates { print <<"HTML";
  E-mail Updates   / top /  
  None for now! Check back later. HTML print <<"HTML";
HTML } sub Prayer_Letters { print <<"HTML";
  Prayer Letter   / top /  
  HTML opendir( PL_DIR, "./prayer_pages/prayer_letters/" ) or print "ERROR: Could not open correct directory."; my @letters = readdir PL_DIR; my $newest_date = 'first'; my $youngest_file = 0; foreach my $letter ( @letters ) { my $cur_date = -M $letter; if( ($newest_date > $cur_date) || ($newest_date eq 'first') ) { $newest_date = $cur_date; $youngest_file = $letter; } } print "Click here to read the latest prayer letter.\n"; closedir( PL_DIR ); print <<"HTML";
HTML } ################################################################################################################################################ # SUB ROUTINES FOR PRINTING GENERIC HTML ################################################################################################################################################ ##############displays top of media page############## sub Print_Top_HTML { print <<"HTML"; Disciple the Nations - Prayer Requests
  home | who we are | resources | prayer requests | mission & travel | photos/videos


HTML } ##############displays bottom of media page############## sub Print_Bottom_HTML { print <<"HTML";
who we are | resources | prayer requests | mission & travel | photos/videos  
all site content copyright of Disciple the Nations, all rights reserved | site designed by ramey design
HTML }