定制 weboftalent/portlets 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

weboftalent/portlets

Composer 安装命令:

composer require weboftalent/portlets

包简介

Module to quickly render portlets of data from a simple template call

README 文档

README

Build Status Scrutinizer Code Quality Code Coverage Build Status codecov.io

Latest Stable Version Latest Unstable Version Total Downloads License Monthly Downloads Daily Downloads

Dependency Status Reference Status

codecov.io

  • Adds a convenience template call that allows one to search for N of a certain type of DataObject and then render them with a given template.
  • Forces interfaced access to information about the data object such as title and image.

Installation

composer require "weboftalent/portlets:^4"

Usage

Interface for Models

For a model to be rendered as a portlet, it must provide the 3 following methods and implement the RenderableAsPortlet interface

public function getPortletTitle();
public function getPortletImage();
public function getPortletCaption();

Templates

The model being rendered must implement the RenderableAsPortlet interface mentioned previously. An example call to render portlets is as follows:

$RenderPortlet('Activity','','Title',2,'SmallTitleAndImage')

The parameters are as follows:

  • The class name, in this case we are looking objects of class Activity
  • Filter, i.e. the WHERE clause of the search. In this case no filter has been applied
  • The sort field, in this case title.
  • The number of items to return, in this case 2
  • The name of the template used to render the portlets, here SmallTitleAndImage

In the template used to render the portlet, the records can be accessed using <control Records> - an example is below.

<ul class="slides">
<% control Records %>
<li>
<a href="$Link"><h5>$PortletTitle</h5>
<% control PortletImage %><% control SetWidth(170) %><img src="$URL"/><% end_control %><% end_control %>
</a>
<% end_control %>
</li>
</ul>

Silverstripe Version Compatibility

2.4 (tested with 2.4.5+) - stable24 branch 3.0 - stable30 branch

统计信息

  • 总下载量: 262
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2013-11-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固