webfox / silverstripe-page-documents
该包已被废弃,不再维护。没有建议的替代包。
一个silverstripe文档模块
v1.1.4
2016-03-21 02:21 UTC
Requires
README
这是一个为silverstripe实现的文档模块,它通过扩展实现后端功能,但不会规定前端!
如何使用
通过composer安装
composer require webfox/silverstripe-page-documents
应用于您希望“文档类别”标签出现的任何页面类型
(可以应用于多个页面类型)
Page: extensions: - PageDocumentsExtension page_documents: title: 'Page Documents' #Tab Title: defaults to 'Document Categories' folder: 'Docs' #Where to store docs: defaults to 'Documents' section: true #If true the documents are stored in a child folder named after the #category e.g. Docs/Category-Title/myfile.pdf: defaults to false
在前端使用
<% if $DocumentCategories.Exists %>
<% loop $DocumentCategories %>
<% if $SortedDocuments.Exists %>
<h2>Category: {$Title}</h2>
<% loop $SortedDocuments %>
<p>
<a href="{$Link}" download="{$FileName}">{$Title} [{$Size}]</a>
</p>
<% end_loop %>
<% end_if %>
<% end_loop %>
<% end_if %>