futjikato/readcounter

此包提供了一种非常简单的机制来计数页面浏览次数并将其保存为页面属性。

安装: 245

依赖: 0

建议: 0

安全: 0

星标: 0

关注者: 2

分支: 1

开放问题: 0

类型:typo3-flow-package

v1.0.1 2016-02-03 10:49 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:58:23 UTC


README

此包提供了一种非常简单的机制来计数页面浏览次数并将其保存为页面属性。

安装

下载后,请检查neos后端是否已启用此包作为应用程序或插件。

在您的主Configuration/Routes.yaml中添加以下片段以激活包

-
  name: 'Futjikato.ReadCounter'
  uriPattern: '<ReadCounterSubroutes>'
  subRoutes:
    'ReadCounterSubroutes':
      package: 'Futjikato.ReadCounter'

通过ajax调用的路由是/readcounter/tracking?node=<nodePath>

应该被计数的每个页面都必须通过Futjikato.ReadCounter:CounterMixin混合扩展

'Futjikato.DemoSite:CountedPage':
  superTypes:
    'TYPO3.Neos.NodeTypes:Page': true
    'Futjikato.ReadCounter:CounterMixin': true
  ui:
    label: 'Counted Page'

混合扩展页面以添加一个readcounter属性,您可以用作排序属性或在页面上某处渲染它。此外,混合还添加了一个子节点以渲染跟踪代码。

以下是一个示例typescript页面配置

prototype(Futjikato.DemoSite:CountedPage.Page) < prototype(Futjikato.DemoSite:Page) {
    body {
        templatePath = 'resource://Futjikato.DemoSite/Private/Templates/Page/CountedPage.html'
        parts {
            // used to render the current page read counter
            counter = ${q(documentNode).property('readcounter')}
        }
        content {
            // render a simple script tag that will track the page view
            trackingcode = Futjikato.ReadCounter:TrackingElement {
                nodePath = 'trackingcode'
            }
        }
    }
}