Version 2
Date: 31.01.2001
The module allows the easy display and administration of news. Every
news-article is assigned to a channel.
Furthermore the module demonstrates the way news can be displayed as
PDF and WML.
Examples for this can be found in the directory "moduledemos".
Backoffice-Part:
The channels and the news-arcticles can be created and edited under
two backoffice administration items.
At least one channel has to exist to be able to create a new news-article.
A headline has to be specified as well.
Important: A Channel wich is still in use by at least one news-article
can't be deleted!
There are different filters for the news-articles which allow to display
only certain news.
For every channel there are three filters, which:
a) display the last n entries for a channel
b) every entry for a certain day for a channel
c) every entry for a certain month for a channel
There is also a filter which orders all entries according to a certain
parameter.
Possible parameters are:
id, headline, description, author, test, link, date
und channel.
Is here a paramter specified, which is not correct, all entries are
sorted according to their date!
Template-Part:
Templates, which should display news with the help of the module are
controlled by the class
com.opencms.modules.homepage.news.NewsTemplate.
This class has to be determined in the element-definition. There should
always be one element to display the news for one channel.
The channel can be specified with the parameter "channelname" or with
the parameter "channelid", both in the element-definition.
Example:
<ELEMENTDEF name="body">
<CLASS>com.opencms.modules.homepage.news.NewsTemplate</CLASS>
<TEMPLATE>/content/bodys/moduledemos/com.opencms.modules.homepage.news/NewsElement.html</TEMPLATE>
<PARAMETER name="channelname">ZDF</PARAMETER>
</ELEMENTDEF>
or:
<PARAMETER name="channelid">0</PARAMETER>
Attention: if the channel is specified by its name, this has to be changed
if the name of the channel is changed in the backoffice.
This can not happen if the id is used to specify the channel!
If both name and id of the channel are given, only the id will be used.
The method "getNewsList" reads the articles from the database. The
number of entries that should be displayed are given as a parameter of
the method. Actual entries are displayed first. The parameter "-1" returns
all entries.
The method accesses the datablock "newsentry", which has to be declared
in the template. The datablocks
id, headline, description, author, date, link, linktext,
text, channel, a_info1, a_info2, a_info3
are then set by the method.
The method "getSingleNews" can be used to display single news-articles.
Therefore the parameter "id=" has to be attached to the URL. This way
links between a list-view and single elementes can be
achieved.
The method reads the datablock "newsentry" as well.
The datablock "errorText" can be used to define an error message if
the element does not exist.
Comment:
The link can be inserted in two ways into the template. As all other
entries as well, it can be inserted with <process>link</process>.
This can cause problems, when the link (the normal case) is extended
to a real link in the temlplate, but is not given in all news-articles.
Especially when creating PDF-Versions it can happen that no page at
all is displayed.
Because of this the method "getValidURI" has to be used if the link-text
should be used as a real link.
Then PDF-Versions are shown correctly as well, even if the field "link"
was empty.
Version 2 of the NewsModule uses a new Database-Access-Pool, which comes
with OpenCms Version 4.1.55 or higher.
The database-connect-string can be changed under the administration
of the module. The default is "jdbc:opencmspool:mysql".
PDF:
To create PDF-Versions the File "fop_bin.jar" is needed by the servlet-launcher.
Furthermore the class CmsPdfLauncher is needed
inside the "com.opencms.launcher"-package.