Normally Coranto produces static output files with a fixed number of newsitems in each file. Sometimes you are in need of presenting news in a more generic way though, for example one single newsitem or a list of newsitems that matched a certain searchquery. The viewnews.cgi script is the solution to that need, since it dynamically can present newsitems depending on the input params sent to it.
The basic functionality is to be able to present *one* newsitem wrapped up within the style and template of your choice. If you don't provide any specific style or template the default ones will be used. There are a number of addons that extend this basic functionality, for example so that you may present more newsitems than one, a random newsitem or a search result.
Whitin the viewnews.cgi script you find two variables right at the very top, which defines the default style and template to use if none is specified. Normally you don't need to change this but if you want to it is just a matter or changing the name of the style and/or template there. Normally it should look like this:
# Name of style to use if none is set in the url. my $VNStyle = 'Default News Style'; # Name of template to use if none is set in the url (without .tmpl extension). my $VNTMPL = 'viewnews';
To use a style or template other then the one defined in viewnews.cgi use a url like this:
viewnews.cgi?id=[newsid]&style=[style name]&tmpl=[template file] [newsid] = the news items id. [style name] = the styles name, like "Default News Style" (without quotes). [template file] = the filename of the .tmpl file you want to use, like "viewnews" (without .tmpl extension and quotes).
An example url might look like:
viewnews.cgi?id=EpEApluEEyolDIQbHI&style=Default+News+Style&tmpl=news
As you can see the style name should be URL encoded, which means that if you have spaces in the name they should be replaced with a plus sign.
Below is some links to threads at CTUS where common questions in regards to vienews.cgi is covered: