Code Monkey home page Code Monkey logo

silverstripe-news's Introduction

News Module

Note: News module for SilverStripe 2.4 is available on the ss24 branch!

Maintainer Contact

Marcus Nyeholt

<marcus (at) silverstripe (dot) com (dot) au>

Requirements

SilverStripe 3.0.x

Overview

The News module provides a straightforward method for creating and publishing news articles on a website. In some respects it is similar to the Blog module, however news articles are meant to be focused more around press release style content - this means a News Article can be represented by normal Content, a hosted file (eg a PDF) or a completely remote article on a separate website. Additionally, News Articles allow authors to specify a separate Summary from the main content, useful for aggregating content references on your site, and allows authors to attach a thumbnail for an article.

News Holders can be configured to automatically file contained articles into a date based hierarchy, generating a hierarchy for archive purposes.

Unlike the Blog module, the News Module does not support widgets at all, and does not come with Comments enabled by default. While these things could be added on by yourself, it is not core to the functionality of the module.

Documentation

Extract to the "news" directory in your SilverStripe folder, and run dev/build. You should now have a "News Holder" page type, and News Item page types to be created beneath the news holders.

The News module also provides functionality to automatically file articles beneath a hierarchy ordered by Year, Month and day. This will then automatically provide an "archive" type functionality for news articles. To enable this, select the checkbox for "Automatically file contained articles" on the News Holder.

Known issues

When creating articles with the automatic filing functionality, and its eventual parent location isn't visible, the article will initially appear in the root of the site tree, even though it has been created underneath the correct location. Refreshing the tree fixes this problem.

Pagination will not work when using the SubSections loop when the holder contains child holder pages because the Pagination details will be separate for each child holder page. Use the TotalChildArticles loop instead of SubSections to get around this.

<% if TotalChildArticles %>
		<div <% if FirstLast %>class="$FirstLast"<% end_if %>>
			<% include NewsListItem %>
		</div>
		<% if TotalChildArticles.MoreThanOnePage %>
			<div id="NextPrevLinks" class="news-pagination">
			  <% if TotalChildArticles.NotLastPage %>
				<div id="NextLink" class="next">
					<p><a class="next" href="$TotalChildArticles.NextLink" 
						title="View the next page">See older articles</a></p>
				</div>
			  <% end_if %>
			  <% if TotalChildArticles.NotFirstPage %>
				<div id="PrevLink" class="previous">
					<p><a class="prev" href="$TotalChildArticles.PrevLink" 
						title="View the previous page">See newer articles</a></p>
				</div>
			  <% end_if %>
			  <span>
				<% if TotalChildArticles.PaginationSummary %><% loop TotalChildArticles.PaginationSummary %>
				  <% if CurrentBool %>
					<p class="current">
						$PageNum
					</p>
				  <% else %>
					<a class="pagination-link" href="$Link" i
						title="View page number $PageNum">$PageNum</a>
				  <% end_if %>
				<% end_loop %><% end_if %>
			  </span>
			</div>
		 <% end_if %>
<% end_if %>

silverstripe-news's People

Contributors

cjsewell avatar erindru avatar kmayo-ss avatar nyeholt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

silverstripe-news's Issues

RSS feed

Hi,
i just made a Decorator for this module that provides an rss feed for the latest news.
I think this feature would fit pretty well, wouldnt it?

I know this aint the blog module and you probably want to keep it simple but maybe its an option for the core.
If not i could provide the decorator.

Summary field not used in templates

Next thing I have noticed...there is a HtmlEditorField for "Article Summary (displayed in listings)" but it's never used in your default templates. Even though it says it is displayed in the listings (I assumed it was probably the NewsHolder template for the list of News Articles. I looked in the templates and it uses

$Content.Summary(50)

When in my opinion it should just be

$Summary

Just a little confusing to the end user because that field never shows up in the default templates until the actual News Article (NewsArticle.ss). I know that's nit picky...and it's a templating issue that's easily solved, but out of the box it could be a bit confusing. I wouldn't expect to see the summary on the main article page....seems redundant.

NewsListItem makes reference to thumbnail - but that's not specified in the Article

Also found this in the template NewsListItem:

<% if Thumbnail %>$Thumbnail.SetRatioSize(50,50)<% end_if %>

but haven't seen a place in the CMS to load a thumbnail or even a news article photo. I've just been adding them into the Content section of the CMS for each article. Not sure if thats new and hasn't been fully integrated yet. I didn't notice this a week ago.

Validation error

Receive a validation error on the Date selector of the Original Published date upon save&publish;

Fixed by adding a date config on line 36 of NewsArticle.php;

$dp->setConfig('dateformat', 'dd/MM/YYYY');

Problem "Validation has failed"

After a basic french install (don't know if other language than english may be an issue) of SS 2.4.5. I've installed silverstripe-news (into news folder, dev-build etc.).
Created news-holder : ok
When I'm trying to save / publish my first news-article I've got this error message :
"Validation has failed".
I've done my best to keep it very simple (no image, no accents) and filled up every field. But I've got the same error message again and again.

Change to sort by alphabet

I have converted the module to another function, but the functionalities are the same. Only I would like to change the sorting option to alphabet instead of publication date or creation date.
Where can I change that?

Creating NewsArticle - Times out

When creating a new NewsArticle page i get the spinning wheel and it times out, throwing an error.

It times out in "sapphire/thirdparty/Zend/locale/Format.php on line 665.

AutoFiling - wouldn't it be more sensible to use OriginalPublishedDate?

Currently, when using AutoFiling, the news items get filed according to their creation time, i.e the time the page is saved in the CMS.

To me it would be more straightforward if it used the "first published" date instead.

Is there a reason for using creation date? If so, might be worth to add to the readme :-)

changing it for me is simple (getPartitionedHolderForArticle - just replace $article->Created with $article->OriginalPublishedDate ) - I wonder more about the decision/rationale behind this.

Describe how the module is different from blog

Hey Marcus, you're pumping out modules by the dozen, aye? Awesome! :)
I've seen a lot of confusion about 1001 different "news" modules back in my Typo3 days,
and would recommend that you add a short paragraph to the README comparing this module to "blog" (e.g. doesn't have RSS, sidebar widgets, but has straightforward and extensible datamodel etc).

Not compatible to SilverStripe 4.0.1

I try to install in SS 4.0.1 but I have an error:
Installation failed, reverting ./composer.json to its original content.

Are you updating the module?

Override $numberToDisplay

HI, trying to figure out how to override the
protected $numberToDisplay = 10;

from an extension - is this possible? Or is there any other way to override this without altering the core module....?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.