nyeholt/news

此包的最新版本(1.3.0)没有提供许可信息。

silverstripe的新闻模块

安装量: 5,200

依赖项: 0

建议者: 0

安全性: 0

星星: 14

关注者: 4

分支: 15

开放问题: 11

类型:silverstripe-module

1.3.0 2016-11-02 11:13 UTC

This package is auto-updated.

Last update: 2024-08-29 04:14:22 UTC


README

注意:SilverStripe 2.4的新闻模块在ss24分支上可用!

维护者联系方式

Marcus Nyeholt

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

要求

SilverStripe 3.0.x

概述

新闻模块提供了一种简单的方法来创建和发布网站上的新闻文章。在某种程度上,它与博客模块相似,但新闻文章更侧重于新闻稿风格的 内容 - 这意味着新闻文章可以由正常的内容、托管文件(例如PDF)或完全远程的独立网站上的文章来表示。此外,新闻文章允许作者从主要内容中指定单独的摘要,这对于在您的网站上聚合内容参考很有用,并且允许作者为文章附加缩略图。

新闻容器可以配置为自动将包含的文章归档到基于日期的层次结构中,为存档目的生成层次结构。

与博客模块不同,新闻模块完全不支持小部件,并且默认情况下不启用评论。虽然您可以通过自己添加来实现这些功能,但这不是模块功能的核心。

文档

将文件提取到您的SilverStripe文件夹中的"news"目录,并运行dev/build。现在您应该有一个"新闻容器"页面类型,以及可以在新闻容器下创建的新闻项目页面类型。

新闻模块还提供自动将文章归档到按年、月和日排序的层次结构下的功能。这将自动为新闻文章提供"存档"类型的功能。要启用此功能,请选中新闻容器上的"自动归档包含文章"复选框。

已知问题

在创建具有自动归档功能的文章时,如果其最终父位置不可见,文章最初将出现在网站树根处,即使它已经被创建在正确的位置之下。刷新树可以解决这个问题。

当容器包含子容器页面并使用子部分循环时,分页将不起作用,因为每个子容器页面的分页详情将是分开的。请使用TotalChildArticles循环代替子部分来解决此问题。

<% 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 %>