-
Notifications
You must be signed in to change notification settings - Fork 0
sliker/CakePHP-Counter-Plugin
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The Count Plugin provides count functions for CakePHP. /* * Count Plugin for CakePHP 2 * * PHP version 5 * * @copyright Copyright 2010, Cake. (http://trpgtools-onweb.sourceforge.jp/) * @category README * @package Count Plugin * @version 0.1 * @author Cake <cake_67@users.sourceforge.jp> * @update David <david@davidvu.co> * @license http://www.opensource.org/licenses/mit-license.php The MIT License * @link https://github.com/Cake/CakePHP-Counter-Plugin */ ## Requirements ## * PHP version: PHP 5.2+ * CakePHP version: 2.x ## Functions ## +Behavior -Countup - saveCount([$foreign_key]) save a count. $foreign_key : The unique id of model. -getTotalCount([$foreign_key, $conditions]) get total counts by he model (and the foreign_key). $foreign_key : The unique id of model. $conditions : Optional conditions to get total counts. The format is same as $model->find(). +Helper -Count - totalCount($data[, $options]) Output total count. $data : data type array('Count' => array(...)). $options : array type. $options['tag'] sets the type of tag. Default is span. other parameters are the HTML attributes(id, class and so on). #Installation Create table by schema. ==== cake schema create counts -plugin count( -dry) ==== Add Countup Behavoir at the model. ==== var $actsAs = array( 'Count.CountUp', ); ==== Call saveCount() to count up. ==== (Example: At controllers) $this->[Modelname]->saveCount($id); ==== The total count can be displayed by the Count helper. ==== (Example: At controllers) var $helpers = array( 'Html', 'Count.Count', ); (At view) echo $count->totalCount($link, array( 'tag' => 'div', 'id' => 'total_count', 'class' => 'link', )); ====
About
Counter Plugin for CakePHP
Counter Plugin for CakePHP.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published