tNews Version 0.95 Beta README
Copyright 2000-2001 Stephen G. Walizer aka Technomancer all rights reserved.
License

This software is licensed under the GNU GPL. See the included file GPL for license details.

Bug Reports

Send bug reports or questions to technomancer@technomancer.cjb.net

About

tNews is a set of PHP3/4 scripts designed to provide basic news headline support for websites. The system uses HTML based templates to specify formatting of news pages, providing complete control of page appearance to the webmaster. The system's backend is provided by a MySQL database, and support is included for generation of both news and old news pages. News HTML pages are only regenerated when changes are made to news headlines, so end users suffer no delays caused by database access or parsing of scripting code.

The most current version of tNews is available at http://technomancer.cjb.net.

Installation

Installation of tNews consists of the following steps:

  1. Move the files contained in the tNews package to a directory that allows execution of PHP scripts. It is recommended that this directory be secured as anyone with access to this directory can change your news headlines.
  2. Edit the tnconfig.inc file with your favorite text editor and set the values of the following variables:

    MySql control parameters:

    $host
    The host variable contains the host for the MySql server to connect to. This is usually localhost if the database server resides on the same machine as the web server.
    $username
    The user name to connect to use when connectiong to the MySql server.
    $password
    The password to use when connecting to the MySql server.
    $database
    The name of the database to use when connecting to the MySql server.
    $newstable
    The table name in the MySql database where news headlines will be stored.

    News control parameters:

    $max_news_items
    The maximum number of news items to be displayed on the main news HTML page. Headlines over this number will be automatically moved to the old news HTML page when a new news item is added. If this value is set to 0 news items will never be marked old based on the number of news items.
    $max_news_age
    The maximum age in days for news items on the main news HTML page. Headlines older than this will be moved to the old news HTML page when a new news item is added. If this value is set to 0 or a negative number items will not be moved to the old news page based on age.
    $newsfile
    The location and name of the HTML file to be generated containing the news headlines. Be sure the webserver has permission to write to this file.
    $newstemplate
    The location and name of the template file used to generate the news display page pointed to in $newsfile. For more information on template files see the TEMPLATE FILES section of this document.
    $oldnewsfile
    The location and name of the HTML file to be generated containing the old news headlines. Be sure the webserver has permission to write to this file.
    $oldnewstemplate
    The location and name of the template file used to generate the old news display page pointed to in $oldnewsfile. For more information on template files see the TEMPLATE FILES section of this document.
    $addescape
    This flag controls the escaping of special characters in news items. Valid values are 'Y' and 'N'. Most installations of PHP3/4 automatically escape special characters, so the default value is 'N'. If you have problems adding news containing apostrophes, set the value to 'Y'.
  3. Create the template files for generation of your news and old news HTML pages. Example template files are included as news.tmpl and oldnews.tmpl and the more information about the contents of template files is included in the TEMPLATE FILES section of this document.
  4. Load the buildtable.php file in a web browser. This page executes a set of MySql commands that build the table to hold your news headlines.
  5. Load the index.html file from the directory you placed the tNews scripts in and start adding news items.
Data Import/Export

Starting with the 0.95b release tNews now allows you to export your data for import into another tNews installation. To export your data make sure PHP has write permissions for the directory tNews is installed in. Once this is done simply click the Export DB Table Data link in the tNews menu. This will generate a script called tn_import.php which contains your database data and code to insert it into an existing tNews installation.

To import your data into a new or existing tNews installation simply copy the tn_import.php file into the tNews install directory and click the Import DB Table Data link in the tNews menu. (If you are importing data into a new installation, be sure you have built your database tables using the Build DB Tables link in the tNews menu before trying to import.)

Usage

tNews is very easy to use. Simply load index.html in the tnews directory in a web browser and select the desired function. The main web page contains options to add news, edit existing news, mark news deleted, undeleted deleted news, and purge deleted news. The only option that is not really self explanatory is purging deleted news items. Deleted news items are simply marked as deleted and left in the database, allowing them to be undeleted later. Selecting purge permanently removes all deleted all from the database.

Generation of news and old news HTML files is performed automatically, as are moving news items from news to old news once the news page contains more than max_news_items set in tnconfig.inc. For more information on tnconfig.inc and on configuring tNews, see the INSTALLATION section of this document.

This release includes a shortcut for creating urls in headlines and news items. The function to do this has two format, one with a target and one without:

url(url,name,target);
url(url,name);

When using these functions they must be entered exactly as above. Do not place spaces between the arguments.

To give a concrete example:

This is a link to url(http://slashdot.org,Slashdot,_blank);, a linux news site.

would be converted to

This is a link to Slashdot, a linux news site.

when the news page is created.

Template Files

Template files provide complete control of news headline generation. A tNews template is simply an HTML file which includes some custom tags. These custom tags are as follows:

<newsloop> </newsloop>
The newsloop tag specifies that all HTML within the tags should be repeated once for each news item present. The newsloop tag is removed completely from the generated HTML file.
<day>
The day tag is replaced by the 2 digit day of the month the news item was created. Values will be between 01 and 31.
<month>
The month tag is replaced by the 2 digit month of the year the news item was created. Values will be between 01 and 12.
<year>
The day tag is replaced by the 4 digit year the news item was created.
<milhour>
The milhour tag is replaced by the 2 digit hour the news item was created in in 24 hour military time format. Values will be between 00 and 24.
<hour>
The hour tag is replaced by the 2 digit hout the new item was created in standard 12 hour time format. Values will be between 01 and 12.
<ampm>
The ampm tag is replaced by either A.M. or P.M. based on the hour the news item was created.
<minute>
The minute is replaced with the 2 digit minute in which the news item was created. Values will be between 00 and 59.
<second>
The second tag will be replaced by the 2 digit second in which the news item was created. Values will be between 0 and 59.
<headline>
The headline tag will be replace by the headline entered when the news item was created.
<news>
The news tag will be replaced by the body of the news item entered when the news item was created.
The tNews package includes an example template file as news.tmpl.