eDNews Documentation

applies to: eDNews version 2
developed by: eDreamers

Description

eDNews is a PHP module to display news or quotes on your website or within your web application. Its main characteristic is the news display algorithm which use random only at the last moment and guarantees that each news is displayed and read equitably. Screenshots and a live demo are available on the eDreamers website.

Installation

Requirements

The following components are required (between brackets the one used during the eDNews developments):

On Windows, PHP and the Apache web server can be installed in a few mouse clicks thanks to EasyPHP. Simply download and install this free tool (10 Mo) if you don't have yet such an environment on your machine. We also recommend the use of phpMyAdmin for the management of your MySQL database.

Unpacking the Archive

If it's the FIRST TIME you're installing eDNews you just have to extract the archive under any path at the root of your webserver.

If you already have a previous version of eDNews installed, we advice you put the new version in another folder so that you can keep the both configuration file and update the new one based on your previous parameters.

Once successfully extracted, the following should be available in the target folder:

Configuration

All the configuration parameters can be found and modified in the myConfig.php file and explanations are provided in english in the file itself before each configuration parameters.

eDNews Root URL
This could be the only parameter you need to set, indicating where eDNews is installed on the webserver:
$CONFIG['root'] = 'http://pathto/eDNews/';
Assuming you created a sub-folder under the root of your local webserver, for example C:/Program Files/EasyPHP/www/eDNews/ (using EasyPHP on Windows) then the value should be:
$CONFIG['root'] = 'http://localhost/eDNews/';
eDNews Default Language
Default language of eDNews is set to english and you can decide to change it to french, the other language supported by default by eDNews. Later in this document, we'll explain how to add languages to eDNews.
$CONFIG['language']     = 'en';        // 'fr' | 'en'
eDNews Database Connection
eDNews is in fact composed of two modules: eDNews itself and eDToolbox. Both have their configuration files and both are accessing the news database (yes you understand it well, eDNews is not always using the eDToolbox scripts to access the database). In the eDNews configuration file myConfig.php, you will specify the connection parameters to the news MySQL database from the hostname to the database name.
$CONFIG['host']             = 'hostname';   // host of the MySQL db
$CONFIG['user']             = 'username';   // user to access the news db
$CONFIG['password']         = 'changeme';   // password to access the news db
$CONFIG['db']               = 'dbname';	    // database name
You have to do the same in the eDToolbox configuration file eDToolbox/config.php with the same values. The parameters name are different from the eDNews because the needs of eDToolbox are different as well but you should not worry about it.
$CONFIG[++$i]['host']   = 'hostname';
$CONFIG[$i]['user']     = 'username';
$CONFIG[$i]['password'] = 'changeme';
We recommend that you create a specific user to access the news database with limited privileges (SELECT, INSERT and UPDATE are the only ones required).
Module Configuration Variables
You can specifically influence the module functionalities by using the $CONFIG['display_add'] and $CONFIG['expirationDelay'] parameters. Read more in the configuration file itself.
Other Configuration Variables
The configuration file is containing other parameters that, in most cases, you won't have to bother about. Some are explained in the following as allowing for example, to easily integrate eDNews in your application or to debug eDNews in case you want to modify it.

Integrating eDNews in your Web Application

As said earlier, eDNews is meant to be integrated seamlessly (or not) in your website or web applications. This is usually causing 2 problems:

  1. integrating the module navigation in the site or application navigation
  2. applying the site visual design (at least not breaking it)

Module Navigation

All the links (well 4 links) used by eDNews are not hardcoded but controlled via the following configuration parameters:

$CONFIG['addURL']           = $CONFIG['root'].'?action=add';
$CONFIG['startURL']         = $CONFIG['root'].'?action=null';
$CONFIG['viewURL']          = $CONFIG['root'].'?action=view';
$CONFIG['archiveURL']       = $CONFIG['root'].'?action=archive';

The current values are set in order to work with the sample index.php which is showing one way to integrate eDNews: calling all components from one page using an action variable to switch between the components (add, start, view or archive) using a switch() {} statement.

<?php
if ( isset( $_REQUEST['action'] ) ) { $action = $_REQUEST['action']; } else { $action = null; }
require dirname(__FILE__).'/myConfig.php';

switch( $action ) {
	case 'view':
		if ( isset( $_REQUEST['newsid'] ) ) { ${$CONFIG['fld_id']} = $_REQUEST['newsid']; }
		else if ( !isset( ${$CONFIG['fld_id']} ) ) { ${$CONFIG['fld_id']}  = null; }
		require dirname( __FILE__ ).'/eDNews_view.php';
		break;
	case 'add':
		require dirname( __FILE__ ).'/eDNews_add.php';
		break;
	case 'archive':
		require dirname( __FILE__ ).'/eDNews_archive.php';
		break;
	default:
		require dirname( __FILE__ ).'/eDNews.php';
		break;
}
?>

You can decide to do the same thing and just need to copy and paste the PHP code you'll find in the index.php file. Another typical configuration is to have one component per page or the viewer used in multiple pages and the rest of the components to add and view the archives in one single but different page. If you need some assistance, contact us anytime at support@edreamers.org or by posting a message to the Forums

Visual Design

to be documented

Use of Templates

to be documented

Language Management

to be documented

_

Questions, Feedback & Support

If you need support during the installation of this patch, please contact us at support@edreamers.org.