dev-master
9999999-dev http://www.label305.comBehavior for registering hits
The Requires
- php >=5.3
- composer/installers *
by Joris Blaak
component cakephp seo hits
Behavior for registering hits
For registering hits on models, (*1)
No maintenance intended, (*2)
This project is no longer actively maintained. It does its job, but there are no plans to extend or change it., (*3)
Add the repository to your requirements and load using composer, (*4)
"require": { "label305/hittable": "dev-master" }
To install the corresponding hits
table, run schema create --plugin=Hittable
in the Cake shell, (*5)
Load Hittable.Hittable
as behavior in the model you want to have hits registered for. After this you can register hits like:, (*6)
$this->Page->id = 1; $this->Page->registerHit();
Which will result in an entry in the hits table., (*7)
To retrieve the hits you can use the hits
call like you've been used to with find
. For example:, (*8)
$this->Page->hits('count', array( 'conditions' => array( 'Page.id' => 1 ) ));
will return the number of hits on Page with id 1, note that this call is internally handled by calling find on the Hit model which has a belongsTo association that handle the conditions., (*9)
If you want to set and forget it is possible to turn on automatic registering of hits. You can turn this on by settings the automatic
settings while loading:, (*10)
$actsAs = array( 'Hittable.Hittable' => array( 'automatic' => true ) );
Copyright 2014 Label305 B.V., (*11)
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at, (*12)
http://www.apache.org/licenses/LICENSE-2.0, (*13)
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License., (*14)
Behavior for registering hits
component cakephp seo hits