# ------------- # Links # ------------- # Links Manager # # File: site_html.pl # Description: This library contains all the HTML that will be generated in # the finished directory. # Author: Alex Krohn # Email: alex@gossamer-threads.com # Web: http://www.gossamer-threads.com/ # Version: 2.0 # # (c) 1998 Gossamer Threads Inc. # # This script is not freeware! Please read the README for full details # on registration and terms of use. # ########################################################## ## Globals ## ########################################################## # You can put variables here that you would like to use throughout # the site. $date = &get_date; $time = &get_time; ########################################################## ## Font and Body Settings ## ########################################################## # Here is all the font setting for the site. # $font = 'font face="Arial" size=2 color="#000000"'; $font_size1 = 'font face="Arial" size=1 color="#000000"'; $font_2 = 'font face="Verdana" size=2 color="#000000"'; $font_main = 'font face="Tahoma" size=2 color="#000000"'; $font_menu = 'font face="Arial, Verdana" size=2 color="#000000"'; $font_copyright = 'font face="Verdana, arial" size=1 color="#FFFFFF"'; $font_footop = 'font face="ms sans serif" size=1 color="#000000"'; $font_footspace = 'font face="Times New Roman" size=3 color="#000000"'; $site_body = 'body bgcolor="#7DBB8F"'; $site_metades = qq~ ~; $site_metakey = qq~ ~; ########################################################## ## Site Regular Images ## ########################################################## # Site Images - This is where all the main images that # need to be called all the time in the coding are listed. $site_picpagetitle = qq~ ~; $site_piclinedown = qq~ ~; $site_picbottomend = qq~ ~; $site_pictopend = qq~ ~; $site_piccontents = qq~ ~; ########################################################## ## Menu Options ## ########################################################## # Site Menu - This is the list of options that appear down # the left hand side. $site_menu = qq~

<$font_menu> Home
Search
Pro Shop
Calender
Links

Advertise
~; ########################################################## ## Site Search Box ## ########################################################## # Site Search Box - The follow coding will call the sites # search box. $site_searchbox = qq~

Search:

~; ########################################################## ## Site Advertising ## ########################################################## # Site Adverts - The follow coding will call the sites # banner requirements. ########################################################## # 468 x 60 Pixel Banners # $site_mainadvert = qq~ Click Here to Visit our Sponsor ~; ########################################################## # 80 x 32 Pixel Banners # $site_buttonadvert = qq~ Please visit our sponsors. ~; # NEW - Category Only Search. $site_catsearch = qq~

<$font>Search only in $category_clean -
~; ########################################################## ## Site Mailing List ## ########################################################## # Site Mailing List - The follow coding will display the # sites mailing list subcription information. $site_mail = qq~

Subscribe to our action packed, monthly newsletter! Enter your address below:-

~; ########################################################## ## Site Footer Options ## ########################################################## # Site Footer - This is the list of options on the foot # of the pages. $site_footeroptions = qq~
<$font_footop> Home <$font_footspace> | <$font_footop> Search <$font_footspace> | <$font_footop> Pro Shop <$font_footspace> | <$font_footop> Calender <$font_footspace> | <$font_footop> Links <$font_footspace> | <$font_footop> Advertise
~; ########################################################## ## Site Copyright Notice ## ########################################################## # Site Copyright - This is the Copyright Notice that # appears at the bottom of any page that you want it to # appear on. $site_copynotice = qq~
© 1999 March New Media. All Rights Reserved March New Media ~; ########################################################## ## A Link ## ########################################################## sub site_html_link { # -------------------------------------------------------- # This routine is used to display what a link should look # like. It's a little complex looking just because we have to # check for blank entries.. my (%rec) = @_; $output = qq| <$font>$rec{'Title'}
|; if ($rec{'Description'}) { $output .= qq| <$font>$rec{'Description'}\n|; } if ($rec{'isNew'} eq "Yes") { $output .= qq| |; } if ($rec{'isPopular'} eq "Yes") { $output .= qq| |; } $output .= qq|
<$font_size1>(Date Added: $rec{'Date'}, Hits: $rec{'Hits'})
<$font_size1>$rec{'URL'}

|; return $output; } ########################################################## ## Home Page ## ########################################################## sub site_html_home { # -------------------------------------------------------- # This routine will build a home page. It is not meant to have any # links on it, only subcategories. # # $category : The list of subcategories. # $time : The current time. # $date : The current date. # $grand_total : The total number of links. # my ($output); $output = qq~ UK Golf Course Guide $site_metades $site_metakey <$site_body>
$site_menu $site_mainadvert

$site_searchbox <$font_main>Welcome to the UK's most comprehensive golf course listing service, providing the details that individuals, golfing societies and golf secretaries need for that prefect golfing experience.



$site_footeroptions
~; return $output; } ########################################################## ## What's New Page ## ########################################################## sub site_html_new { # -------------------------------------------------------- # This routine will build a what's new page. You can use the following # variables # # $time : The current time. # $date : The current date. # $total : The total number of new links. # $grand_total : The total number of links. # $link_results : The list of new links. # $title_linked # $output = qq~ $site_title: What's New <$site_body>

$title_linked

$site_title: What's New

$site_menu

$total New Links:

$link_results $site_search $site_footer ~; return $output; } ########################################################## ## What's Cool Page ## ########################################################## sub site_html_cool { # -------------------------------------------------------- # This routine will build a what's new page. You can use the following # variables # # $time : The current time. # $date : The current date. # $total : The total number of new links. # $grand_total : The total number of links. # $percent : The cool percent cutoff (top 3%, etc). # $link_results : The list of cool links. # # Your Title and Header. $output = qq~ <$dtd> $site_title: What's Cool <$css> <$site_body>

$title_linked

$site_title: What's Cool - The Top $percent!

$site_menu

$total Cool Links:

$link_results $site_search $site_footer ~; return $output; } ########################################################## ## Detailed View ## ########################################################## sub site_html_detailed { # -------------------------------------------------------- # This routine will build a single page per link. It's only # really useful if you have a long review for each link -- # or more information then can be displayed in a summary. # my %rec = @_; $output = qq~ <$dtd> $site_title: $rec{'Title'} <$css> <$site_body>

$title_linked

$site_title: Detailed View!

$site_menu

$rec{'Title'}

$rec{'Description'}

Submitted by: $rec{'Contact Name'} -- $rec{'Contact Email'}
Hits: $rec{'Hits'}

Visit this link. $site_search $site_footer ~; return $output; } ########################################################## ## Category Pages ## ########################################################## sub site_html_category { # -------------------------------------------------------- # This rountine will build a page based for the current category. # Insert the following variables in the appropriate place. # # $category : The list of subcategories. # $links : The list of links in this category. # $time : The current time. # $date : The current date. # $title_linked : A linked version of the title bar. # $title : An unlinked version of the title bar. # $total : The total number of links in this category. # $grand_total : The total number of links. # $category_name : The category name. # $category_name_escaped : The category name URL escaped (used for the Add function) # $category_clean : The category name with _ and / removed. # # The following will work assuming you haven't changed the order of the # category database. If you have, or have added new fields, you can access # any of the information by using $category{$category_name}[field_num] where # field number is the number (indexed from 0) of the field you want. Otherwise # you can just use the following: # # $description : Category Description # $meta_name : Meta Description Tag # $meta_keywords : Meta Keywords Tag # $header : Custom Header # $footer : Custom Footer # $related : A

  • list of related categories. # my ($output); $output = qq~ UK Golf Course Guide: $category_clean $site_metades $site_metakey <$site_body>
    $site_menu $site_mainadvert

    $site_searchbox

    <$font><$title_linked
    ~; if ($header) { $output .= qq~

    <$font size=5>$header


    ~; } if ($category) { $output .= qq~ <$font>$category
    ~; } if ($links) {$output .= qq~ <$font>$links
    ~; } if ($related) { $output .= qq~ <$font>$related ~; } if ($prev or $next) { $output .= qq~

    ~; } if ($prev) { $output .= qq~<$font>Prev $build_links_per_page ~; } if ($next) { $output .= qq~<$font>Next $build_links_per_page ~; } if ($prev or $next) { $output .= qq~

    ~; } if ($footer) { $output .= qq~

    $footer

    ~; } $output .= qq~

    $site_footeroptions
    ~; return $output; } ########################################################## ## Category Listings ## ########################################################## sub site_html_print_cat { # -------------------------------------------------------- # This routine determines how the list of categories will look. # We now use a table to split the category name up into two columns. # For each category you can use the following variables: # # $url : The URL to go to that category # $category_name : The category name with _ and / removed. # $category_descriptions{$subcat}: The category description (if any). # $numlinks : The number of links inside that category (and subcategories). # $mod : The newest link inside of that category. # my (@subcat) = @_; my ($url, $numlinks, $mod, $subcat, $category_name, $description, $output, $i); my ($half) = int (($#subcat+2) / 2); # Print Header. $output = qq~
    \n~; foreach $subcat (sort @subcat) { ($description) = @{$category{$subcat}}[2]; # First let's get the name, number of links, and last modified date... $url = "$build_root_url/" . &urlencode($subcat) . "/"; if ($subcat =~ m,.*/([^/]+)$,) { $category_name = &build_clean($1); } else { $category_name = &build_clean($subcat); } $numlinks = $stats{"$subcat"}[0]; $mod = $stats{"$subcat"}[1]; # We check to see if we are half way through, if so we stop this table cell # and begin a new one (this lets us have category names in two columns). if ($i == $half) { $output .= qq~\n~; } $i++; # Then we print out the name linked, new if it's new, and popular if its popular. $output .= qq|
    <$font>$category_name ($numlinks)|; $output .= qq|<$font_new>New| if (&days_old($mod) < $db_new_cutoff); $output .= qq|
    |; $output .= qq|
    <$font>$description
    | if (!($description =~ /^[\s\n]*$/)); $output .= qq|
    |; } # Don't forget to end the unordered list.. $output .= "
    \n"; return $output; } ########################################################## ## Add Resources ## ########################################################## sub site_html_add_form { # -------------------------------------------------------- # This routine determines how the add form page will look like. # my $category = shift; $category ? ($category = qq~$category ~) : ($category = &build_select_field ("Category", "$in{'Category'}")); &html_print_headers; print qq~ $site_title: Add a Resource <$site_body>
    $site_menu

    $site_topsearchbox


    <$font>Please fill out the form completely, and we'll add your resource as soon as possible.
    <$font>Title:
    <$font>URL:
    <$font>Category: ~; $db_select_fields{'Category'} = join (",", &category_list); print &build_select_field ("Category", "$in{'Cat'}"); print qq~
    <$font>Description: (Max 25 Words)
    <$font>Postcode:
    <$font>Contact Name:
    <$font>Contact Email:
    Expires in: days if you have a temporary link.

    Check this box if you DO NOT wish to recieve e-mail about site updates and special events.

    <$font>
    Webmasters! Increase the popularity rating of your site by linking to us.
    Just email us for the HTML to include in your site!
    $site_bottomsearchbox
    $site_footeroptions
    $site_copynotice
    $site_rightmenu
    ~; } sub site_html_add_success { # -------------------------------------------------------- # This routine determines how the add failure page will look like. You have # access to the following variables: # # %in : the variables used to add the link, useful in confirming what was # added. # &html_print_headers; print qq~ <$dtd> $site_title: Resource Added <$css> <$site_body>

    $site_title: Resource Added

    $site_menu

    We have received the following link:

              Title:  $in{'Title'}
                URL:  $in{'URL'}
        Description:  $in{'Description'}
       Contact Name:  $in{'Contact Name'}
      Contact Email:  $in{'Contact Email'}
           Category:  $in{'Category'}
    

    Thank you! We will send you an email once your link has been validated.

    $site_search $site_footer ~; } sub site_html_add_failure { # -------------------------------------------------------- # This routine determines how the add failure page will look like. You have # access to the following variables: # # $errormsg : A bulleted list of the problems. # %in : variables used in adding the form. Useful for recreating # the form # my ($errormsg) = $_[0]; &html_print_headers; print qq~ <$dtd> $site_title: Error Adding Resource. <$css> <$site_body>

    $site_title: Error Adding Resource

    $site_menu

    There were the following errors trying to add your resource:

    $errormsg

    Please make any changes and try again!

    Title:
    URL:
    Category: ~; $db_select_fields{'Category'} = join (",", &category_list); print &build_select_field ("Category", "$in{'Category'}"); print qq~
    Description:
    Contact Name:
    Contact Email:
    $site_search $site_footer ~; } ########################################################## ## Modify Resources ## ########################################################## sub site_html_modify_form { # -------------------------------------------------------- # This routine determines how the modify form page will look like. # You should include a text field for the URL to be modified as well # as a new form for the new link information. # &html_print_headers; print qq~ <$dtd> $site_title: Modify a Resource <$css> <$site_body>

    $site_title: Modify a Resource

    $site_menu

    Please enter the URL of the link you wish to update. Make sure it is identical to the one already in the database:

    Now enter the new information (all of it, not just the changes) below:

    Title:
    URL:
    Category: ~; $db_select_fields{'Category'} = join (",", &category_list); print &build_select_field ("Category", "$in{'Category'}"); print qq~
    Description:
    Contact Name:
    Contact Email:
    $site_search $site_footer ~; } sub site_html_modify_success { # -------------------------------------------------------- # This routine determines how the modify failure page will look like. You have # access to the following variables: # # %in : the variables used to modify the link, useful in confirming what was # modified. # &html_print_headers; print qq~ <$dtd> $site_title: Resource Modified <$css> <$site_body>

    $site_title: Resource Modified

    $site_menu

    We have received the following link:

              Title:  $in{'Title'}
                URL:  $in{'URL'}
        Description:  $in{'Description'}
       Contact Name:  $in{'Contact Name'}
      Contact Email:  $in{'Contact Email'}
           Category:  $in{'Category'}
    

    Thank you! We will send you an email once your record has been validated.

    $site_search $site_footer ~; } sub site_html_modify_failure { # -------------------------------------------------------- # This routine determines how the modify failure page will look like. You have # access to the following variables: # # $errormsg : A bulleted list of the problems. # %in : variables used in modifying the form. Useful for recreating # the form # my ($errormsg) = $_[0]; &html_print_headers; print qq~ <$dtd> $site_title: Error Modifying Resource. <$css> <$site_body>

    $site_title: Error Modifying Resource

    $site_menu

    There were the following errors trying to modify your resource:

    $errormsg

    Please make any changes and try again!

    Please enter the URL of the link you wish to update. Make sure it is identical to the one already in the database:

    Now enter the new information (all of it, not just the changes) below:

    Title:
    URL:
    Category: ~; $db_select_fields{'Category'} = join (",", &category_list); print &build_select_field ("Category", "$in{'Category'}"); print qq~
    Description:
    Contact Name:
    Contact Email:
    $site_search $site_footer ~; } ########################################################## ## Search Results ## ########################################################## sub site_html_search_results { # -------------------------------------------------------- # This routine displays the search results. # my (@hits) = @_; my $term = &urlencode ($in{'query'}); &html_print_headers; print qq~ UK Golf Course Guide: Search Results <$site_body>
    $site_menu $site_mainadvert

    $site_searchbox
    <$font> Your search for $in{'query'} resulted in:
    $cat_hits Matching Towns
    $link_hits Matching Golf Courses


    ~; if ($next) { my (@lang) = ("first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eigth"); print qq~ <$font> Here is the $lang[$in{'nh'}] $maxhits matches. Get the next $next_hits matches? ~; } if ($category_results) { print qq~ <$font>$category_results ~; } if ($link_results) { print qq~ <$font>$link_results ~; } if ($next) { print qq~ <$font> Here is the $lang[$in{'nh'}] $maxhits matches. Get the next $next_hits matches? ~; } print qq~


    $site_footeroptions
    ~; sub site_html_search_failure { # -------------------------------------------------------- # This routine displays a failed search page with error in $error. # my ($error) = shift; my $term = &urlencode ($in{'query'}); &html_print_headers; print qq~ UK Golf Course Guide: Search Failed <$site_body>
    $site_menu $site_mainadvert

    $site_searchbox
    <$font>

    <$font>Error: Sorry we currently don't have anything matching $in{'query'} listed.

    Please try searching using another keyword.



    $site_footeroptions
    ~; } sub site_html_search_form { # -------------------------------------------------------- # This routine displays the search form. my $action = shift; &html_print_headers; print qq~ <$dtd> $site_title: Search Options <$css> <$site_body>

    $site_title: Search Options

    $site_menu
    Search:
    Number of Results:
    As Keywords: As Phrase:
    AND connector: OR connector:
    $site_footer ~; } ########################################################## ## Email Updates ## ########################################################## sub site_html_mailing { # -------------------------------------------------------- # This routine displays your mailing list subscribe/unsubscribe form. # my $action = shift; my $message; ($action eq 'subscribe') and ($message = qq~You've been successfully subscribed to the mailing list!~); ($action eq 'unsubscribe') and ($message = qq~You've been successfully removed from the mailing list!~); &html_print_headers; print qq~ <$dtd> $site_title: Email Updates <$css> <$site_body>

    $site_title: Email Updates

    $site_menu

    $message

    Keep informed of new additions to $site_title, by subscribing to our low-volume newsletter that will deliver new listings straight to your inbox!

    to the list
    Name: Email:

    $site_footer ~; } sub site_html_mailing_error { # -------------------------------------------------------- # This routine is displayed if there was a problem subscribing. # my $error = shift; &html_print_headers(); print qq~ <$dtd> User Error <$css>

    Oops, there was a problem!

    Error: $error

    Please go back to fix the problem.

    ~; } ########################################################## ## Rate Resources ## ########################################################## sub site_html_ratings { # -------------------------------------------------------- # This routine determines how the top rated page will look like. # You can use: # $top_rated : a three column table without and
    tags. # $top_votes : a three column table without and
    tags. # # my %rec = @_; &html_print_headers; my $output = qq~ <$dtd> $site_title: Top Rated <$css> <$site_body>

    $site_title: Top Rated

    $site_menu

    Top 10 Resources (by Rating)

    $top_rated
    Rating# VotesResource

    Top 10 Resources (by Votes)

    $top_votes
    Rating# VotesResource
    $site_search $site_footer ~; return $output; } sub site_html_rate_form { # -------------------------------------------------------- # This routine determines how the rate form page will look like. # my %rec = @_; &html_print_headers; print qq~ <$dtd> $site_title: Rate a Resource <$css> <$site_body>

    $site_title: Rate a Resource

    $site_menu

    Please rate the link $rec{'Title'} between one and ten, with ten being tops.

    $site_search $site_footer ~; } sub site_html_rate_success { # -------------------------------------------------------- # This routine determines how the add failure page will look like. You have # access to the following variables: # # %in : the variables used to add the link, useful in confirming what was # added. # &html_print_headers; print qq~ <$dtd> $site_title: Resource Rated <$css> <$site_body>

    $site_title: Resource Rated

    $site_menu

    Thank you for your vote.

    $site_search $site_footer ~; } sub site_html_rate_failure { # -------------------------------------------------------- # This routine determines how the rate failure page will look like. You have # access to the following variables: # # $errormsg : A bulleted list of the problems. # my $errormsg = shift; &html_print_headers; print qq~ <$dtd> $site_title: Error Rating Resource. <$css> <$site_body>

    $site_title: Error Rating Resource

    $site_menu

    Sorry, but we were unable to rate the resource for the following reason:

    $errormsg

    Please contact the site administrator if you have any questions.

    $site_search $site_footer ~; } 1;