承接 venveo/view-count 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

venveo/view-count

Composer 安装命令:

composer require venveo/view-count

包简介

Keep track of view counts over a period of time to show popular entries.

README 文档

README

Keep track of view counts over a period of time to show popular elements. Right now, it lumps views into aggregates by day.

Usage

After installing and enabling, all you need to do is register a view count in the template:

{% do craft.viewcount.increment(entry.id) %}

Of course, it doesn't need to be an entry id, it could be any element ID, such as a category.

To start using views in your query, all you need to do is use the "views" keyword in your order parameter. For example:

{% set blogPosts = craft.entries({
    section: 'blog',
    order: 'views DESC',
    limit: 10
}) %}

This will sort based on the number of views in the past 24 hours.

Settings

Right now, there is a single setting to toggle whether view counts should be recorded to logged in users.

Developer Events

The following events are emitted to allow for programmtic customization:

EVENT_REGISTER_VIEW

You can listen for this event on the venveo\viewcount\services\ViewCount class to control whether a view count should be registered. The event class, ViewCountEvent, contains:

  • $elementId - The element ID being registered as a view
  • $siteId - The id of the site the element resides on
  • $shouldSkip - a boolean for whether the view should be skipped

Requirements

This plugin requires Craft CMS 3.0.0-beta.23 or later.

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
    
  2. Then tell Composer to load the plugin:

     composer require venveo/view-count
    
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Popular Entries.

Brought to you by Venveo

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-10-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固