The following functions for creating news feeds are available in the CMS:
In the system settings, channels can be defined.
Channels serve to group news by topic, i.e. to categorize
them with respect to what their contents is about. This
is similar to categorizing product descriptions by means
of a field named ProductGroup
. The channel
settings can be accessed via the Content Navigator's
System Configuration menu item available in the
Extras menu.
The versions of files of the Folder and
Document type have a built-in field named
channels
. This is a multi-selection field;
therefore, any subset of the channels that have been
defined in the system configuration can be assigned to
it. This is how content and a set of channels are
associated with each other.
File formats have the
canCreateNewsItem
field (Mark as new on
the live server). If this option has been chosen,
files based on this format are added to an internal news
list upon release unless the channels
field
of the released version is empty.
Lists of news article files can be created in which
the articles are assigned to any set of channels you
determine. For this, an NPSOBJ instruction and a Tcl
command is available. The NPSOBJ instruction returns,
analogous to the toclist
instruction, a
context list, so that the fields of the version can be
queried. The Tcl command is news
.
For creating news lists in layouts the
npsobj newslist
command can be used in
three ways:
Creating a list of all news articles in all channels:
<npsobj newslist="all" length="20"> Text evaluated for each news article </npsobj>
Creating a news list where each article is contained in at least one of several channels assigned to a field of the document being exported:
<npsobj newslist="selected" name="Channel-Feld" length="20"> Text evaluated for each article belonging to the channels specified indirectly </npsobj>
The field must be either of the
string
, text
,
selection
, or multiselect
type. With the string
and
text
types, the channels must be a
comma-separated list. With selection
and
multiselect
fields, the field values are
used unmodified as channels.
Creating a list of news assigned to channels that are specified directly:
<npsobj newslist="selected" value="ch1, ch2, ..." length="20"> Text evaluated for each article belonging to the channels specified directly </npsobj>
Even if a news article has been assigned to more than one of the channels specified directly or indirectly, it is never contained more than once in the news list generated.
Generated news lists only include articles whose
publication date lies in the past (relative to the export
time of the document containing the list). Of course, the
news list internally contains all of the articles to which
a channel has been assigned and that were chosen for
publication via the canCreateNewsItem
file
format field. Initially, the publication date equals the
creation date of the news file. If required, this date can
be modified via the validFrom
field of the
draft version.
A news article that was published accidentally can
therefore be removed from the news list by specifying a
future date as the publication date. However, after this
change it is still contained in the internal news list
unless the news file itself is deleted or all channels are
removed from the channels
field of the
article. A file is also removed from the news list if the
channels to which the article is assigned are deleted from
the system configuration. However, this does not modify the
channels
field of versions, meaning that it
may contain the names of nonexistent channels. News
articles assigned to nonexistent channels are not placed
into the internal news list again if the missing channel is
created again.
If the Template Engine is used, all the files containing
an npsobj newslist
instruction are
exported again after changes have been made to files or the
channel configuration so that the news lists generated are
always up-to-date. (A usesAll
dependency
is assigned to the files.)
Creating a list of 10 most recently published articles
Create a channel named sitenews.
Create a file format named newsitem
and activate its canCreateNewsItems
(Mark as new on the live server) option.
Create a file named news1
based on the
newsitem
format anywhere in the folder
hierarchy.
Into the layout of the start page insert code like the following:
<ul> <npsobj newslist="all" lenght="10"> <li> <npsobj insertvalue="anchor" destination="self"> <npsobj insertvalue="var" name="title" /> </npsobj> </npsobj> </ul>
Creating an RSS feed for politics news
Create a channel named politics
;
Create a file format named newsitem
and activate its canCreateNewsItems
(Mark as new on the live server) option.
Create a field named description
and a
file format named feed
and add
description
to the format. Do not activate
canCreateNewsItems
.
Create a folder named rssfeeds
.
In this folder create a base layout
(mastertemplate
) that outputs an RSS-Feed
(see below).
In the same folder, create a file named
politicsfeed
based on the feed
format. Enter as description
"Latest company
politics news". As Channels specify
politics
.
Set the main content of the base layout to the following:
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.92//EN" "http://my.netscape.com/publish/formats/rss-0.92.dtd"> <rss version="0.92"> <channel> <description> <npsobj insertvalue="var" name="description" /> </description> <language>de</language> <title><npsobj insertvalue="var" name="title" /></title> <link>http://www.mysite.com/</link> <copyright>(c) JustRelate Group GmbH</copyright> <generator>CMS Fiona 6.0</generator> <ttl>60</ttl> <npsobj newslist="selected" name="channels" length="20"> <item> <title><npsobj insertvalue="var" name="title"/></title> <link>http://www.mysite.de<npsobj insertvalue="var" name="visiblePath" /> </link> <description> <npsobj insertvalue="var" name="description"/> </description> </item> </npsobj> </channel> </rss>
For creating an RSS file in a different version (2.0, for example), the layout file can be adapted as desired.
To create another feed, sports news, by means of the layout file above:
sports
.rssfeeds
create a file
named sportsfeed
based on the
feed
format and enter "Sports News" into its
description
field. Select
sports
as channels.newsitem
format and assign to them the sports
channel. They will appear in the sports news feed.Sending out Newsletters
newsletters
.newsletter
.newsletters
create a
file named politics
based on the
newsletters
format.politics
enter the e-mail addresses, on address per line. exportBlob
field of
politics
to each e-mail address contained in
the main content of politics
.