承接 doublesecretagency/craft-viewcount 相关项目开发

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

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

doublesecretagency/craft-viewcount

Composer 安装命令:

composer require doublesecretagency/craft-viewcount

包简介

Count the number of times an element has been viewed.

README 文档

README

Plugin icon

View Count plugin for Craft CMS

Count the number of times an element has been viewed.

Example of View Count results

Track views via Twig, PHP, or AJAX

Basic tracking looks like this...

{% do craft.viewCount.increment(elementId) %}

However, there are several more advanced ways to increment a view counter.

Allow multiple counters on the same element

If you need to track multiple aspects of the same element, it's easy to do so! Simply specify an optional key when setting up the tracking mechanism.

Sort by "most viewed"

Once you've started logging views, you'll likely want to know which items have been viewed the most...

{% set articles = craft.entries.section('articles') %}
{% do craft.viewCount.sort(articles) %}

Display view totals in the control panel

You can add a "Total Views" field, which displays a read-only total for each element.

Events

They do exactly what you think...

  • EVENT_BEFORE_VIEW
  • EVENT_AFTER_VIEW

Within the EVENT_BEFORE_VIEW event, you can prevent the view from being counted.

Further Reading

If you haven't already, flip through the complete plugin documentation.

And if you have any remaining questions, feel free to reach out to us (via Discord is preferred).

On behalf of Double Secret Agency, thanks for checking out our plugin! 🍺

Logo for Double Secret Agency

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2019-01-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固