NewsScript.co.uk - News content management system

This simple to use content management system will allow you to show the headlines and summary on any webpage and link to the full article, all in the same style as your website. You can add delete and edit news with ease using the administrator suite. The advanced version can split the headlines over many page and has a search engine, scrolling news ticker and newsletter mode. (CGI/Perl Unix)

» Overview of the script
» Set-up the script
» Create your database
» Five quick ways to protect your database
» Create the template for the headlines
» Create the template for the news 
» Inserting the headlines into a webpage
» Adding a search engine
[Xtra version only]
» Adding a news ticker to another webpage [Xtra version only]
» Using the News Letter mode [Xtra version only]
» How to use the administrator suite


Overview of the script

NewsScript.co.uk
:
The user visits a webpage and the news headlines and summary are automatically included. By clicking on a headline they are taken to the full story. The style of the headlines and the news page is managed by a simple template. Using the administration suite the webmaster can add, edit and delete pages from the database.

NewsScript.co.uk Xtra:
The user visits a webpage and the news headlines and summary are automatically included. By clicking on a headline they are taken to the full story. The style of the headlines and the news page is managed by a simple template. Using the administration suite the webmaster can add, edit and delete pages from the database. With the Xtra version a user can search the database for news items. You can also display the news in a newsletter mode and news ticker.

Files you will need:
NewsScript.co.uk script (download from this website)
Template for the headlines (instructions on this page)
Template for the web pages (instructions on this page)

Things you have to do:
Follow the instructions below
Download the NewsScript.co.uk script and make a few changes
Create a link in your webpage
Create a 'template' in your own style for the news
Create a 'template' in your own style for the headlines
Upload the script and webpages
Use the administration suite to add, edit or delete news.

Site Security

Minimum Requirements:
Your own website with FTP access
Permission to run CGI scripts on your server
UNIX web hosting with Perl 5.006001 or greater

Features NewsScript.co.uk Xtra
For commercial and private use YES YES
Can be used on as many websites as I build YES YES
No adverts or links in the script YES YES
Instant download YES YES
Show headlines and news on any webpage YES YES
Add, edit and delete news YES YES
Show the headlines in any style you choose YES YES
Show the pages in any style you choose YES YES
Include images in both the templates YES x1 YES x2
Upload images with the pages YES YES
Password Protection YES YES
Split the headlines over many pages - YES
Automatic database creation by script YES YES
Search engine for the database - YES
News Ticker for any webpage - YES
News Letter mode - YES
     

[back to the top]



Set-up the script

NewsScript.co.uk
(Current Version: 01/March/2005)

Check your path to perl
#!/usr/bin/perl

Full URL of this script
my $script_name = 'http://www.your-url.co.uk/cgi-bin/newsscript.pl';

Change the Full Path (not URL) of your database,
this will be created when you first add a record.
my $databasefile = "/home/vhosts/cgi-bin/news.txt"; 

Change the Full Path (not URL) of the directory the images are stored in
my $image_dir = "/home/vhosts/cgi-bin/images/";

Change the URL (not Path) of the directory the images are stored in,
without the last trailing slash /
my $image_url = "http://www.your-url.co.uk/cgi-bin/images";

The Full Path (not URL) of the headlines template
my $html_template = "/home/vhosts/cgi-bin/headlines.htm";

The Full Path (not URL) of the news web page template
my $record_template = "/home/vhosts/cgi-bin/news.htm";

You can change the 'admin' mode name to anything you like, so mode=admin can be any 'word' that you choose it to be.
my $admin_mode = 'admin';

To use the select image option use 1 to turn it off use 0
my $select_image = 1;

Select the value of the Horizontal and Vertical spacing round the images.
my $hspace = 9;
my $vspace = 2;

Select a username and password or leave blank.
my $Username = 'name';
my $Password = 'password';

Display the news items first or last
my $news_up = 1;

Upload and CHMOD 755, or 777 if not public.

[back to the top]


NewsScript.co.uk Xtra (Current Version: 01/March/2005)

Check your path to perl
#!/usr/bin/perl

Full URL of this script
my $script_name = 'http://www.your-url.co.uk/cgi-bin/newsscript.pl';

Change the Full Path (not URL) of your database,
this will be created when you first add a record.
my $databasefile = "/home/vhosts/cgi-bin/news.txt"; 

Change the Full Path (not URL) of the directory the images are stored in
my $image_dir = "/home/vhosts/cgi-bin/images/";

Change the URL (not Path) of the directory the images are stored in,
without the last trailing slash /
my $image_url = "http://www.your-url.co.uk/cgi-bin/images";

The Full Path (not URL) of the headlines template
my $html_template = "/home/vhosts/cgi-bin/headlines.htm";

The Full Path (not URL) of the news web page template
my $record_template = "/home/vhosts/cgi-bin/news.htm

You can change the 'admin' mode name to anything you like, so mode=admin can be any 'word' that you choose it to be.
my $admin_mode = 'admin';

To use the select image option use 1 to turn it off use 0
my $select_image = 1;

Select the value of the Horizontal and Vertical spacing round the images.
my $hspace = 9;
my $vspace = 2;

Select a username and password or leave blank.
my $Username = 'name';
my $Password = 'password';

Message to display if no news is found with a search.
my $not_found = '<b>No results found</b><br><br><br>';

Display the news items first or last
my $news_up = 1;

Text for 'previous' button
my $textPrevious = "Previous";

Tex for 'next' button
my $textNext = "Next";

Number of pages in the range at any time
my $pageSelectorRange = 10;

Number of headlines per page
my $records_per_page = 5;

Number of headlines in the scrolling news ticker, use 0 for all
my $Number_of_headlines_to_scroll = 5;

Speed of the news ticker
my $speed = 4;

Background colour of the news ticker
my $bgcolor = "#eeeeee";

Number of news items in the newsletter mode, use 0 for all news
my $Number_of_news = 10;

Seperator between headlines and news in newsletter mode.
my $head_news_separator = "<hr noshade color=#000000><br>";

Seperator between news items in newsletter mode.
my $new_news_separator = "<hr noshade color=#000000><br>";

You can request the script to 'Highlight' the results of a search with a different colours. Use 1 to switch this feature on a 0 to switch it off. This will work with the search=value but not with fieldname=value. You can not use a field that is searched in HTML code in your website with this feature.

my $highLighting = 1;
my @highLightColors = ("#FFFF00", "#FF0000", "#00FFFF", "#00FF00", "#C0C0C0");

Upload and CHMOD 755, or 777 if not public.

[back to the top]


Create your database

When you first add a record the script will create the database for you. You don't need to create one.

NewsScript.co.uk is designed for a small to medium website and can manage around 100 records or 1MB to run smoothly on most servers.

NOTE: Please do not use field names in your database used in the script or template, including, name, method, action, page, record, header, random, display, search, order_by, order, mode & headlines.

[back to the top]


Five quick ways to protect your database

1) Download the current version of the script
2) Use the username and password feature
3) Re-name the script from newsscript.pl to anything.pl
4) Re-name the database from news.txt to anthing.txt
5) Re-name the mode=admin to mode=anything

[back to the top]


Create the template for the headlines

This will display the headlines in the way you wish to see them. Use the sample template first to ensure everything is working okay, then customise the template to your needs. Everything inside the template brackets is repeated for each record (including any HTML code), everything outside the template brackets is displayed just once.

Sample code for the headlines template. You do not need to use all the features, for example you could just display the headlines without the page summary. The <<headline>> will automatically link to the full story as will the <<more>>. The short text will display your summary of the webpage. By adding <<page_selector>> (Xtra version only) anywhere on the page (outside the template brackets) you can link to the rest of the headlines. The <<date>> is just a text field and a option to add a date in the format you wish to type it.



A sample template is enclosed with your download.

[back to the top]


Create the template for the news

This will display the news story or webpage in the way you wish to see them. Use the sample template first to ensure everything is working okay, then customise the template to your needs.

Sample code for the news template. The code around the <template> brackets is your normal HTML page. Inside the <template> bracket is data for that page. You can display the information in any format you wish. Change the font the location of the image, the size of the headline, add a menu images, almost anything you would do with an HTML page, keep it simple or make it as creative as you wish. The script will insert the data where you tell it to.




A sample template is enclosed with your download. With NewsScript.co.uk Xtra you add a second image using <<image2>> ideal for a thumbnail image 

[back to the top]


Inserting the headlines into a webpage

You can display headlines in two ways, by using a link or a virtual include on another webpage on your site.

To have a virtual include on a webpage you must use Server Side Includes. To do this rename your htm or html page to shtml.

Then add <!--#include virtual="/cgi-bin/newsscript.pl"--> at the location you wish to see the headlines. Use the features below in the same way to choose the way the headlines are displayed.

/cgi-bin/newsscript.pl or
<!--#include virtual="/cgi-bin/newsscript.pl"-->
This will display the number of headlines selected in the script in the format of your headlines template. Ideal as a link from the main page.

/cgi-bin/newsscript.pl?headlines=3 or
<!--#include virtual="/cgi-bin/newsscript.pl?headlines=3"-->
This will display a requested number of headlines in the format of the headlines template. Ideal as a second news page with less headlines.

/cgi-bin/newsscript.pl?mode=shtml or
<!--#include virtual="/cgi-bin/newsscript.pl?mode=shtml"-->
This will display all the headlines, ignoring all the code outside the template brackets of the headlines template. Ideal for inserting all the headlines in another webpage on your site where you don't want to use the full headlines template.

/cgi-bin/newsscript.pl?headlines=3&mode=shtml or
<!--#include virtual="/cgi-bin/newsscript.pl?headlines=3&mode=shtml"-->
This will display a requested number of headlines, ignoring all the code outside the template brackets of the headlines template. Ideal for inserting a few headlines in another webpage. Ideal for inserting just a few headlines in another webpage on your site where you don't want to use the full headlines template.

[back to the top]


Adding a search engine [Xtra version only]

With NewsScript.co.uk Xtra you can add a search engine to allow users to search all the database or just one field. You can do this with links or a search box in a form.

Basic search of all the database:

Search:



Add the option for an exact phrase match only:

Search: Exact:



Give the option of the field to search:

Search:
Field:
All Headlines  Summary Main Text

    

Add both the field to search and the option of an exact match:

Search: Exact:
Field:
All Headlines  Summary Main Text



Add the option for the user to choose hoe many results per page:

Search:  
Field:
All Headlines  Summary Main Text Exact Match:



[back to the top]


Adding a news ticker to another webpage [Xtra version only]

You can add a fixed number of news headlines to any page in your website using a SSI (Server side include). To do this name your page .shtml rather than .htm or .html and where you want the ticker to be included add the code below:

<!--#include virtual="/cgi-bin/newsscript.pl?mode=scrollingnews"-->

You can change the font using a style sheet or adding the font details before the SSI code.

Latest News: Barn Owl     Bears     Big Cats     Birds of prey     Chimpanzees    


[back to the top]


Using the News Letter mode [ Xtra version only]

You can display all the news headlines and the full story or a fixed number as a News Letter in any page in your website using a SSI (Server side include). To do this name your page .shtml rather than .htm or .html and where you want the ticker to be included add the code below:

<!--#include virtual="/cgi-bin/newsscript.pl?mode=newsletter"-->

[back to the top]


How to use the administrator suite

You can now edit, delete and add records with the administrator suite. Just type the URL in your browser of the administrator site:

/cgi-bin/newsscript.pl?mode=admin

If you have selected to have a username and password you will be asked for it at this point.

Do not use your browsers 'back' button when in the administrator suite. Now you will see the main page that lists all the pages in your system, you can delete, edit or view a record in the list using the menu on the left. Or add a new record from the menu at the top of the page.

To help navigate the text fields for Date and Headline are displayed. Once using the administrator suite you will see it is very simple and needs no instructions to use.

[back to the top]

 

 

NewsScript.co.uk
Contact
Downloads
Instructions
Demonstrations
Users Comments
Version History
News
Other EZ Scripts
EZScripting
Galleryscript
Forumscript
EZMailer.net
Help & Support
FAQ
Basic CGI Guide
Help Forum