Creation and Maintenance of JPLCG Web Pages


Table of Contents
Introduction
Web Page URL
Testing New or Modified Content Files
Content Files
PHP Content Insertion Code
Miscellaneous

Introduction

Content files are used with the "index.php" file to dynamically create web pages. Modifications to a content file will be seen the next time the page is accessed.

Content files contain html commands and text that is inserted into the output of the "index.php" file to create a unique web page. The "index.php" file contains a common header, footer, and menu for each web page. An optional scrolling marquee is also available.

The use of a single PHP file (index.php) gives the web site a common "look and feel".

Note: Most, but not all web pages are created using "index.php" and a content file. For example, this one.

Summary:

  • The "index.php" file is used to generate web pages dynamically
  • "index.php" provides a common "look and feel" for web pages
  • Content files provide the information that make the web pages unique
  • Most (but not all) web pages are created using "index.php" and a content file
  • To modify a web page, modify it's content file
  • Modify "index.php" to change the common "look and feel" (header, menu, or footer)

Web Page URL

A content file is specified as part of the URL that executes the "index.php" file. For example,
www.jplgc.org/index.php?content=test.txt
will insert the data found in the file "test.txt" into the web page. If no content is specified in the URL, "home.txt" is used.

Testing New or Modified Content Files

Before making an new or modified content file "official", it should be tested. A simple way to do this is:
  1. Create a test content file (for example xyz.txt)
  2. Upload the test content file to the JPLGC web site
  3. Test the content file using a browser. Enter,
    www.jplgc.org/index.php?content=xyz.txt
  4. Modify the content file, and go to step 2 until satisified
  5. Replace the "official" content file with "xyz.txt"
  6. Delete the test content file from the JPLGC web site

Content Files

The following are the content files as of June 9, 2010.
activities.txt
activities_pistol.txt
activities_rifle.txt
activities_shotgun.txt
ammo_guns_acc.txt
books_videos.txt
calendar.txt
calendar_maintenance.txt
documents.txt
faq.txt
for_women.txt
home.txt
hunting.txt
law_research.txt
links.txt
marquee.txt
meeting_minutes.txt
membership.txt
officers.txt
organizations.txt
pictures.txt
ranges.txt
training.txt
web_page_maintenance.txt
web_site_documentation.txt

Note: content files can have any name. They currently end with ".txt" for convenience. (It is probably not a good idea to end them with ".html", "xhtml", "htm", etc.)

PHP Content Insertion Code

The following is the PHP code in the "index.php" file that inserts content file data into the output web page.


  <?php

    if (!isset($_GET['content']))
    {
      if (file_exists('home.txt'))
      {
        @include('home.txt');
      }
      else
      {
        print '<center>';
        print 'Internal Error<br/>';
        print 'home.txt file not found<br/>';
        print 'Please report this error to the webmaster';
        print '</center>';
      } 
    }
    elseif ($_GET['content'] != "")
    {
      $content = $_GET['content'];

      if (file_exists($content))
      {
        @include($content);
      }
      else
      {
        print '<center>';
        print 'Internal Error<br/>';
        print $content.' file not found<br/>';
        print 'Please report this error to the webmaster';
        print '</center>';  
      }
    }
    else
    {
      print '<center>';
      print 'Internal Error<br/>';
      print 'URL has no content file specified<br/>';
      print 'Please report this error to the webmaster';
      print '</center>';
    }

  ?>

Miscellaneous

Menu PNG Files

The common "look and feel" menu is made up of PNG images, and are in the root directory of the web site. More PNG images are available than are currently used in anticipation of possible changes. Others can be created as needed.

This HTML File

This HTML file is "hard coded" and not created dynamically. This makes printing the file easier. (No extra "stuff" printed, missing files not a problem, etc.)