Problem: WWWBoard gets huge especially at very busy sites. The WWWBoard can grow in many Megs and takes a very long time to download.
Old Solution: Manually create archives or just delete older messages. This grows old quickly so I wrote this program add-on
Solution: Break the WWWboard up into manageable pieces, create an interface to jump between pages, allow the users to post from each page, and allow it still to be customizable.
This is a solution to huge bulletin boards and archiving. The creates a manageable multi-pages layout from the original wwwboard. Plus configuration options of number of posting per page and multi-pages names.
More Clarification:
Question: What happens after I delete a message using a admin scripts?
Answer: The multipages are create each time a new post occurs. So
after 1 post it will be updated. (I may create a add-on that interacts with the admin
scripts to update multipages)
Question: What if someone post a new topic of one of the older page ?
It will exceed the pre-define max message number. Will the script reorganized every page
then ?
Answer: First it writes to the front single page than the multipages are
total recreated and your message will appear on page one.
If your replying to a post it will be include on the page of the original post.
Question: I have auto-email notification when someone post a new message.
How will I know which page the message is being written to ?
Answer: Same as above.
Question:. I have an add-on to add a "new" graphics for each
new messages (based on message number). Does it means that the add on will only want on
the latest page or the one page version only ?
Answer: Remember the MultiPage board just makes a copy of the one page
version and then breaks it up into manageable pages. So I believe it will work.
Question: I also have an add-on for search. Do I need to specify all the
multiple page ?
Answer:If one uses Matt's search script, it just searches all of the
files in the messages directory so it does not matter whether you are on the single page
or one of the multiple pages (assuming you have added the appropriate link to the
multi-page script).
If you have more questions??? I have set up a MultiPage Bulletin Board.
I have been testing the multi-page layout on three boards for about a month. If you have added this add-on to your page send and email to webmaster@vaultworld.com and we'll add it to working examples.
Others Using the Multi-Page Layout
Symptom: One Huge Last Page?
Solution: I've seen this once and it was do to a missing
<!--end--##--> Statement. This only happened once and it was because I hand
edited the wwwboard.html. After inserting the correct <!--end--##--> and
adding a new post it corrected its self.
<!--top: 18--><li><a href="messages/18.html">Comments about
the Jobs Board is Welcomed</a> - <b>Webmaster</b> <i>01:31:24
2/08/98</i>
(<!--responses: 18-->0)
<ul><!--insert: 18-->
</ul><!--end: 18-->
Sympton: Updated the WWWboard but not the multiply boards?
Solution: I've seen this once also and I'm not sure why. I suggest
removing all the multiply pages and adding a new posting, this did the trick for me.
Overall, Its been working great on all the sites test and has saved alot of time.
To make it easier. I have include a basic WWWboard with the modifications or you can follow the directions below. I created the multipage bulletin board above using the directions below.
Change the WWWboard Directories Permissions to 777. This
directory must be chmoded 777 so that multiple pages can be
written into it by the server's UID.
Multi-Page Version Downloads: (WWWboard with Add -on ADDED)
Involves editing wwwboard.pl and wwwboard.html files.
Find:
<ul>
<!--begin-->
</ul>
Replace with:
<ul>
<!--begin-->
<!--bottom-->
</ul>
Text Version: Add1.txt
If you already have and exist page just add <!--bottom--> before the last
</ul>
*Note the Multi-Page will work without this edit but this makes sure the last page will be
formatted correctly.
There is three different sections that need to be added to wwwboard.pl. The first is the configurations area, second sub routine calling area, and finally the subroutines.
Note: The Page Color, Text Attribs, and Background I use the suggested:
$body_eval="bgcolor= \"0606f9\" text= \"ffff00\" link= \"ffffff\" vlink= \"cdcdcd\" ";
Text Version: Add2.txt
So just add this line and make the approperiate changes into the configuration section.
Configuration: (Add this to your Configuration Area)
###########################################################################
# New Variables and Multi Page Layout Information
# Create by Steven Miller Jr Email: webmaster@vaultworld.com
# Site http://www.vaultworld.com/cgi-scripts
# Last Updated: 2 Mar 98
###########################################################################
#Config Items
$use_proboard = 1; # 1 = YES; 0 = NO
$pageprefix = "polevault"; #This is the name of the multiply
files ex polevault1.html
$perpagedisplay = 20; #Display the Number of Original Post Per Page
#Note qq? and qq+ same as " but eliminates all \/ /" Stuff
$pagedirectoryfaq = qq? <center>[ <a href="#post">Post
Message</a> ][ <a href="faq.html">FAQ</a> ][<a
href="$mesgfile">One Page Version</a>]\n</center> ?;
$pagedirectory = qq? <center>[ <a href="#post">Post
Message</a> ][<a href="$mesgfile">One Page
Version</a>]\n</center> ?;
$counter = qq+ <!-- Put Your Counter Code Here (Note Only Appears on Page One) -->
+;
###Ads Banner Option
$show_ads = 0; #1 = Yes 0 = No
$adsbanner = qq+ <!-- Enter Your Banner Info Here--> +;
################### No Need to Edit Below Lines
################################
$ext2 = ".html";
$pagename = "";
@page_contents = "";
$countpages = 0; # The Current Page Count
$pages_needed = 0; # Total Number of Pages Needed
$one = 1;
$firstpagename = $pageprefix . $one . $ext2;
Text Version: Add3.txt
Calling Subroutines: Just add what is in Red to your Subroutine Section.
# Open the new file and write information to it.
&new_file;
# Open the Main WWWBoard File to add link
&main_page;
# Now Add Thread to Individual Pages
if ($num_followups >= 1) {
&thread_pages;
}
# Create on the fly Main WWWBoard File
if($use_proboard)
{
&on_the_fly_main_page;
}
# Return the user HTML
if($use_proboard)
{
&return_proboad;
}
else
{
&return_html;
}
# Increment Number
&increment_num;
Text Version: Add4.txt
Subroutines: (Just Copy everything Below and Place it at the Bottom of your wwwboard.pl)
######################################################################################### ######################################################################################### # Multi Board Additions
############################ # On the Fly main page
sub on_the_fly_main_page { $numofmainresponses = 0; open(MAIN,"$basedir/$mesgfile") || die $!; @maincopy = <MAIN>; close(MAIN);
$number_of_lines_maincopy = @maincopy;
#determine the number of main responses not replies for ($count = 0; $count < $number_of_lines_maincopy; $count++) { if ($maincopy[$count] =~ /<!--top: (\d*)-->*/) { $numofmainresponses++; $topvalue = $1; $count++;
do { $count++; }while($maincopy[$count] !~ /<!--end: $topvalue-->*/);
}
}
#determine the interger number of pages
$pages_needed = $numofmainresponses / $perpagedisplay; $pages_needed_remander = $numofmainresponses % $perpagedisplay;
#Store In Interger Format $pages_needed = ($pages_needed - ($pages_needed_remander/$perpagedisplay));
#Added one because a remainder if ($pages_needed_remander) { $pages_needed++; }
#determine what type of pages to type if($numofmainresponses < $perpagedisplay) { #print only one page # Logic: Begin Storing Lines after first top and until bottom tag is found $detect = 0; $countpages = 1; for ($count = 0; $count < $number_of_lines_maincopy; $count++) { if ($maincopy[$count] =~ /<!--bottom.*/) { $detect = 0; } if ($maincopy[$count] =~ /<!--top:.*/ || $detect) { $detect = 1; splice(@page_contents, -1, 0, $maincopy[$count]) } } #Call Write One page &write_one_page; } else { #print more than one page note starts at one the last page will be handle individually #Start from the beginning of a file. $count = 0; for($countpages = 1; $countpages < ($pages_needed + 1); $countpages++) { @page_contents = ""; $detect = 0; for ($counttops = 0;$counttops < $perpagedisplay; ) { # Read the next line of maincopy $count++;
#Error Checking if page in wrong format will exit loop $maincopylength = @maincopy; if ($count == $maincopylength) { $counttops = $perpagedisplay; } if ($maincopy[$count] =~ /<!--bottom.*/) { $counttops = $perpagedisplay; } if ($maincopy[$count] =~ /<!--top: (\d*)-->*/) { $topvalue = $1; $counttops++; $detect = 1; splice(@page_contents, -1, 0, $maincopy[$count]);
#read and store until next top $count++;
while($maincopy[$count] !~ /<!--end: $topvalue-->*/) { splice(@page_contents, -1, 0, $maincopy[$count]); $count++;
last if ($count == $maincopylength);
last if ($maincopy[$count] =~ /<!--bottom.*/);
} # Still want to include last line would have used do loop # but it doens't support last statement splice(@page_contents, -1, 0, $maincopy[$count]);
}
}
# Call Print Pages &print_multi_pages ($countpages, @page_contents) ;
} }
}
############################ # Write One Page Only
sub write_one_page { # Finish by writing the Output to the File
$pagename = $pageprefix . $one . $ext2; open (OUTFILE,">$basedir/$pagename") || die $!; # print header &top_of_form2; print OUTFILE "<ul>"; # print body $number_of_lines_body = @page_contents; for ($count4 = 0; $count4 < $number_of_lines_body; $count4++) { print OUTFILE "$page_contents[$count4] \n"; }
#print ending &rest_of_form2;
close(OUTFILE);
}
############################ # Write Multi Pages
sub print_multi_pages { my ($countpages, @page_contents) = @_; # Finish by writing the Output to the File
$pagename = $pageprefix . $countpages . $ext2; open (OUTFILE,">$basedir/$pagename") || die $!;
# print header &top_of_form2; &print_page_numbers; print OUTFILE "<ul>";
# print body $number_of_lines_body = @page_contents; for ($count4 = 0; $count4 < $number_of_lines_body; $count4++) { print OUTFILE "$page_contents[$count4] \n"; }
#print ending &rest_of_form2;
close(OUTFILE);
} ##################################################################################### # Write to of the Rest of the Form
sub rest_of_form2 { print OUTFILE qq? <a name="post"><center><h2>Post A Message!</h2></center></a><br> \n?; print OUTFILE "<form method=POST action=\"$cgi_url\">\n"; print OUTFILE "Name: <input type=text name=\"name\" value=\"\" size=50><br>\n"; print OUTFILE "E-Mail: <input type=text name=\"email\" value=\"\" size=50><p>\n"; print OUTFILE "Subject: <input type=text name=\"subject\" value=\"\" size=50><p>\n"; print OUTFILE "Message:<br>\n"; print OUTFILE "<textarea COLS=50 ROWS=10 name=\"body\">\n"; print OUTFILE "</textarea><p>\n"; print OUTFILE "Optional Link URL: <input type=text name=\"url\" value=\"\" size=45><br>\n"; print OUTFILE "Link Title: <input type=text name=\"url_title\" value=\"\" size=50><br>\n"; print OUTFILE "Optional Image URL: <input type=text name=\"img\" value=\"\" size=45><p>\n"; print OUTFILE "<input type=submit value=\"Post Message\"> <input type=reset>\n"; print OUTFILE "</form>\n"; print OUTFILE "<br><hr size=7 width=75%>\n"; if($pages_needed != 1) { &print_page_numbers; }
if($countpages == 1) { print OUTFILE "<br> $counter \n"; } print OUTFILE "</body></html>\n"; }
##################################################################################### # Write to of the Form for One Page Only sub top_of_form2 { print OUTFILE "<html>\n"; print OUTFILE " <head>\n"; print OUTFILE " <title>$title</title>\n"; print OUTFILE " </head>\n"; print OUTFILE " <body $body_eval>\n"; print OUTFILE " <center>\n"; print OUTFILE " <h1>$title</h1>\n"; print OUTFILE " </center>\n"; print OUTFILE "<hr size=7 width=75%>\n";
if ($show_faq == 1) { print OUTFILE $pagedirectoryfaq; } else { print OUTFILE $pagedirectory; }
print OUTFILE "<hr size=7 width=75%>\n";
if ($show_ads == 1) { print OUTFILE $adsbanner; print OUTFILE "<hr size=7 width=75%>\n"; }
}
######################################################################################### # Proboard Return
sub return_proboad { print "Content-type: text/html\n\n"; print "<html><head><title>Message Added: $subject</title></head>\n"; print "<body $body_eval><center><h1>Message Added: $subject</h1></center>\n"; print "The following information was added to the message board:<p><hr size=7 width=75%><p>\n"; print "<b>Name:</b> $name<br>\n"; print "<b>E-Mail:</b> $email<br>\n"; print "<b>Subject:</b> $subject<br>\n"; print "<b>Body of Message:</b><p>\n"; print "$body<p>\n"; if ($message_url) { print "<b>Link:</b> <a href=\"$message_url\">$message_url_title</a><br>\n"; } if ($message_img) { print "<b>Image:</b> <img src=\"$message_img\"><br>\n"; } print "<b>Added on Date:</b> $date<p>\n"; print "<hr size=7 width=75%>\n"; print "<center>[ <a href=\"$baseurl/$mesgdir/$num\.$ext\">Go to Your Message</a> ] [ <a href=\"$baseurl/$firstpagename\">$title</a> ]</center>\n"; print "</body></html>\n"; }
##################################################################################### # Write to of the Form for One Page Only sub print_page_numbers {
$pagename = $pageprefix . $countpages . $ext2; $pagenameminus = $pageprefix . ($countpages - 1) . $ext2; $pagenamemore = $pageprefix . ($countpages + 1) . $ext2;
if($countpages == 1) { print OUTFILE "<center>\n"; for ($i = 1; $i <= $pages_needed; $i++) { if ($i == ($countpages + 10)) { #Note qq? same as " but eliminates all \/ /" Stuff print OUTFILE qq? <a href="$pageprefix$i$ext2">[Next]</a> <b>$pages_needed Total Pages</b> \n ?; } # exit out of for loop last if ($i == ($countpages + 10));
if ($i == $countpages) { print OUTFILE qq? [<a href="$pageprefix$i$ext2"><font size =+2>$i</font></a>]?; } else { print OUTFILE qq? [<a href="$pageprefix$i$ext2">$i</a>]?; } } print OUTFILE "</center>\n"; print OUTFILE "<hr size=7 width=75%>\n"; } elsif($countpages == $pages_needed) { if ($pages_needed > 10) {
print OUTFILE "<center>\n"; #Note qq? same as " but eliminates all \/ /" Stuff $i = $pages_needed - 11; print OUTFILE qq? [<a href="$pageprefix$i$ext2">Previous</a>]?;
for ($i = $pages_needed - 10; $i <= $pages_needed; $i++) {
if ($i == $countpages) { print OUTFILE qq? [<a href="$pageprefix$i$ext2"><font size =+2>$i</font></a>]?; } else { print OUTFILE qq? [<a href="$pageprefix$i$ext2">$i</a>]?; } } print OUTFILE "</center>\n"; print OUTFILE "<hr size=7 width=75%>\n"; } else { print OUTFILE "<center>\n"; for ($i = 1; $i <= $pages_needed; $i++) { if ($i == $countpages) { print OUTFILE qq? [<a href="$pageprefix$i$ext2"><font size =+2>$i</font></a>]?; } else { print OUTFILE qq? [<a href="$pageprefix$i$ext2">$i</a>]?; } } print OUTFILE "</center>\n"; print OUTFILE "<hr size=7 width=75%>\n"; } } else { if ($pages_needed > 10) {
print OUTFILE "<center>\n"; #Note qq? same as " but eliminates all \/ /" Stuff $i = $countpages - 1; print OUTFILE qq? [<a href="$pageprefix$i$ext2">Previous</a>]?;
for ($i = $countpages; $i <= $pages_needed; $i++) {
if ($i == ($countpages + 10)) { #Note qq? same as " but eliminates all \/ /" Stuff print OUTFILE qq?<a href="$pageprefix$i$ext2">[Next]</a> $pages_needed Total Pages\n?; } # exit out of for loop last if ($i == ($countpages + 10));
if ($i == $countpages) { print OUTFILE qq?[<a href="$pageprefix$i$ext2"><font size =+2>$i</font></a>]?; } else { print OUTFILE qq?[<a href="$pageprefix$i$ext2">$i</a>]?; } } print OUTFILE "</center>\n"; print OUTFILE "<hr size=7 width=75%>\n"; } else { print OUTFILE "<center>\n"; for ($i = 1; $i <= $pages_needed; $i++) { if ($i == $countpages) { print OUTFILE qq?[<a href="$pageprefix$i$ext2"><font size =+2>$i</font></a>]?; } else { print OUTFILE qq?[<a href="$pageprefix$i$ext2">$i</a>]?; } } print OUTFILE "</center>\n"; print OUTFILE "<hr size=7 width=75%>\n"; } }
}
# End Multi Board Additions ######################################################################################### #########################################################################################
Text Version: Add5.txt
Return to Index Add On Page