# SuperSimpleNews 1.0 Read Me

## Introduction

SuperSimpleNews 1.0 is an Open-source (GPL2) PHP based news script which doesn't require a database as all news articles are stored in simple CSV files. As the name depicts, this is a very simple script which includes a password protected administrative backend for adding, editing and deleting articles. For editing the text the brilliant widgEditor is utilised for it's lightweight simplicity and effectiveness. Example scripts are included to get you setup quickly. RSS support is included by default.

## Installation

1. Copy all the files to your server location, ie www.yourwebsite.com/newsadmin/ Remember:This will be the location of your back-end admin panel not the news page (front-end).
2. Locate the config file 'includes/config.inc.php' (relative to your upload folder) and enter your settings to suit your website and server configuration. You'll notice a 'news_encoding' setting which should be noted because you may have issues with your character encoding if your 'POST' encoding is different from your page encoding!
3. You can now access the back-end by accessing the root of your installation folder. Enter you password and you can start adding news articles!
4. You will now want to intergrate the script into your website. For this examples have been provided (see below) which demonstrate how the 'newsTools' class is accessed to display headlines and a news page.
5. You don't need the 'resources' folder for the script to work on your server, this is only used for the code highlighting on this page.

## Examples

The RSS Feed file can be found here. When setting up your system all paths should be relative to you config and class files found in the 'includes' folder.

### Headlines Example

A working copy of the headlines file can be found here.

<?php //get news class and array include_once('newsadmin/includes/newsTools.class.inc.php'); $newsTools = new newsTools('csv/news.csv'); //a limit of 4 headlines is passed to the function $news_headlines = $newsTools->getNewsArray(4); //output news array as formatted html if (!count($news_headlines)>0){ echo 'There are currently no news headlines.'; }else{ foreach ($news_headlines as $key => $item){ list($news_id,$news_date,$news_title,$news_body) = $item; $formatted_date = date('d.m.y',$news_date); echo $formatted_date.' - '.$news_title.'<br />'; } } ?>

#### Example News Page

a working copy of the News page can be found here.

<?php //get news class and array include_once('newsadmin/includes/newsTools.class.inc.php'); $newsTools = new newsTools('csv/news.csv'); $news_headlines = $newsTools->getNewsArray(); //output news array as formatted html if (!count($news_headlines)>0){ echo '<p>There are currently no news headlines.</p>'; }else{ foreach ($news_headlines as $key => $item){ list($news_id,$news_date,$news_title,$news_body) = $item; $formatted_date = date('F j, Y, g:i a',$news_date); echo <<<HTML <a name="$news_id" id="$news_id"></a> <h3>$news_title</h3> $news_body <p><em>Posted: $formatted_date</em></p> <hr /> HTML; } } ?>

## Feedback

Please contact me via monkeymatt.com if you have any feedback, recommendations or have found a bug.