Skip to content

Instantly share code, notes, and snippets.

@kyv
Created March 14, 2013 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyv/5162455 to your computer and use it in GitHub Desktop.
Save kyv/5162455 to your computer and use it in GitHub Desktop.
cakecd tags plugin pagination
#Model/Image.php
...
public $actsAs = array('Tags.Taggable',
'Containable',
);
...
#Controller/ImagesController.php
...
class ImagesController extends AppController {
var $helpers = array('Tags.TagCloud');
public $paginate = array();
public function index() {
if (isset($this->passedArgs['by'])) {
$this->paginate['Tagged'] = array(
'model' => 'Image',
'tagged',
'by' => $this->passedArgs['by']);
$images= $this->paginate('Tagged');
} else {
$this->Image->recursive = 1;
$images = $this->paginate();
}
#debug($images);
$this->set('images', $images);
$this->set('tags', $this->Image->Tagged->find('cloud', array('limit' => 10)));
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment