2017 © Pedro Peláez
 

silverstripe-module silverstripe-news

A simple news module for SilverStripe

image

silverstripers/silverstripe-news

A simple news module for SilverStripe

  • Tuesday, June 12, 2018
  • by silverstripers
  • Repository
  • 9 Watchers
  • 3 Stars
  • 554 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 3 Versions
  • 3 % Grown

The README.md

SilverStripe News Module

SilverStripe news is a standalone module which provides content editor features to have news and blog posts in a SilverStripe website., (*1)

Read more at SilverStripers.com blog, (*2)

Installing

User composer to install, (*3)

composer require silverstripers/silverstripe-news dev-master, (*4)

Features

  1. Tags
  2. Categories
  3. Archives
  4. Different Types of news posts for different purposes
  5. Use the powerful model admin to manage news
  6. robust search form
  7. friendly urls for tags and categories
  8. Force editing news from the model admin, and doesnt load news pages on to the site tree.

Configs

All the configuration options are added on to Site Config, (*5)

go to SiteConfig from the laft navigation panel and to, (*6)

Settings -> News tab, (*7)

Codes

Add tags to a page

add the following code to your Page.ss file or any other template file which renders contents of a Page., (*8)

<% if $BlogTags %>
  <ul>
  <% loop $BlogTags %>
    <li><a href='{$Link}'>{$Tag} ({$Count})</a></li>
  <% end_loop %>
  </ul>
<% end_if %>

Add blog archive to a page

the module allows you to chose that format of archive you want to use, this can be configured in the Site Config. the options are, (*9)

  1. Year
  2. Year, Full Month (2015, April)
  3. Year, Month Number (2015, 04)
  4. Abbreviated Month Name (Jan, Feb, Mar, etc..)

welcome to add more options for these and submit pull requests, (*10)

<% if $BlogArchives %>
  <ul>
  <% loop $BlogArchives %>
    <li><a href='{$Link}'>{$Archive}</a></li>
  <% end_loop %>
  </ul>
<% end_if %>

Categories

to show the news categories made in the CMS use, (*11)

<% if $NewsCategories %>
  <ul>
  <% loop $NewsCategories %>
    <li><a href='{$Link}'>{$Title}</a></li>
  <% end_loop %>
  </ul>
<% end_if %>

Show news on news index

to show news items on your news index use the following code or similar., (*12)

<% if $Items %>
    <ul class="news-list">
        <% loop $Items %>
        <li class="news-item">
            <h2>{$Title}</h2>
            <time datetime="{$DateTime.Format('Y-m-d')}">{$DateTime.Format('F d, Y')}</time>
            <% if $Summary %>
                $Summary
            <% else %>
                {$Content.FirstSentence}
            <% end_if %>
            <a class="readMore" href="{$Link}">read more&hellip;</a>
        </li>
        <% end_loop %>
    </ul>

    <% if $Items.MoreThanOnePage %>
        <div class="pagination">
            <ul>
                <% if $Items.NotFirstPage %>
                    <li>
                        <a class="prev" href="{$Items.PrevLink}"><span class="arrow-left"></span></a>
                    </li>
                <% end_if %>
                <% loop $Items.Pages %>
                    <li <% if $CurrentBool %>class="active"<% end_if %>>
                        <% if $Link %>
                            <a href="{$Link}">{$PageNum}</a>
                        <% else %>
                            &hellip;
                        <% end_if %>
                    </li>
                <% end_loop %>
                <% if $Items.NotLastPage %>
                    <li>
                        <a class="next" href="{$Items.NextLink}"><span class="arrow-right"></span></a>
                    </li>
                <% end_if %>
            </ul>
        </div>
    <% end_if %>
<% end_if %>

if you want to take the first news articles out of this list, may be on to a hero panel you can do that by passing an offset to the Items functions, (*13)

the function call would be $Items(1) if you dont want the first item to be returned on to the list., (*14)

The Versions

12/06 2018

dev-master

9999999-dev

A simple news module for SilverStripe

  Sources   Download

BSD-3-Clause

The Requires

 

by Nivanka Fonseka

silverstripe news

19/03 2018

dev-2x

dev-2x

A simple news module for SilverStripe

  Sources   Download

BSD-3-Clause

The Requires

 

by Nivanka Fonseka

cms silverstripe news

01/02 2018

dev-dev-2

dev-dev-2

A simple news module for SilverStripe

  Sources   Download

BSD-3-Clause

The Requires

 

by Nivanka Fonseka

cms silverstripe news