2017 © Pedro Peláez
 

silverstripe-module silverstripe-news

A simple news module for SilverStripe

image

richardsjoqvist/silverstripe-news

A simple news module for SilverStripe

  • Wednesday, August 20, 2014
  • by richardsjoqvist
  • Repository
  • 1 Watchers
  • 0 Stars
  • 29 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

SilverSripe Simple news module

A simple news module for SilverStripe, (*1)

Requirements

  • SilverStripe 3.1

Usage

To get news entries you can use the static method NewsHelper::Entries():, (*2)

class Page_Controller extends ContentController
{
    function LatestNews() {
        $itemToSkip = 0;
        $itemsToReturn = 5;
        $namespace = 'news';
        return NewsHelper::Entries($itemsToSkip, $itemToReturn, $namespace);
    }
}

The namespace parameter is configured on the NewsHolder, and can be used to set up several news sections with different news content. For instance you might want a news section with general news, one section with press releases and one section with financial news. In that case the general news section might have the namespace "news", press releases might be called "press" and the financial section could have the namespace "financial"., (*3)

If you omit the third parameter the NewsHelper::Entries() method will return items regardless of the namespace. It is also possible to list items from several selected namespaces by separating them with a comma:, (*4)

class Page_Controller extends ContentController
{
    function LatestNews() {
        $itemToSkip = 0;
        $itemsToReturn = 5;
        $namespace = 'news,press';
        return NewsHelper::Entries($itemsToSkip, $itemToReturn, $namespace);
    }
}

RSS

The news module produces an RSS feed that can be accessed by pointing to the NewsHolder's URL segment and adding /rss at the end. You may also provide additional parameters to control which namespaces entries should be returned from as well as limit and the number of items to skip., (*5)

Format: http://www.domain.com/news/rss/[namespace(s)]/[limit],[skip], (*6)

  • [namespace(s)] can contain one or more namespaces separated with a comma; http://www.domain.com/news/rss/news,press/
  • [limit] and [skip] must both be integer values.
  • If you do not provide the [skip] argument, a default of 0 is used
  • If you do not provide the [limit] argument, a default of 20 is used
  • If you do not provide the [namespace(s)] argument, the namespace of the called newsholder will be used
  • You may provide a wildcard as [namespace(s)] to display entries from all namesspaces; http://www.domain.com/news/rss/*/

The Versions

20/08 2014

dev-master

9999999-dev https://github.com/richardsjoqvist/silverstripe-news

A simple news module for SilverStripe

  Sources   Download

The Requires

 

module silverstripe news

20/08 2014

1.3.1

1.3.1.0 https://github.com/richardsjoqvist/silverstripe-news

A simple news module for SilverStripe

  Sources   Download

The Requires

 

module silverstripe news

10/03 2014

1.3.0

1.3.0.0 https://github.com/richardsjoqvist/silverstripe-news

A simple news module for SilverStripe

  Sources   Download

The Requires

 

module silverstripe news

07/12 2013

1.2.0

1.2.0.0 https://github.com/richardsjoqvist/silverstripe-news

A simple news module for SilverStripe

  Sources   Download

The Requires

 

module silverstripe news

02/12 2013

1.1.0

1.1.0.0 https://github.com/richardsjoqvist/silverstripe-news

A simple news module for SilverStripe

  Sources   Download

The Requires

 

module silverstripe news

03/05 2013

1.0.0

1.0.0.0 https://github.com/richardsjoqvist/silverstripe-news

A simple news module for SilverStripe

  Sources   Download

The Requires

 

module silverstripe news