This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Felix Geisendörfer (author)
Thu Mar 05 18:09:24 -0800 2009
| name | age | message | |
|---|---|---|---|
| .. | |||
| |
cloud.php | Wed Sep 24 00:48:16 -0700 2008 | |
| |
readme.textile | Fri Sep 05 05:21:53 -0700 2008 |
cakephp/behaviors/cloud/readme.textile
CakePHP Cloud Behavior
A CakePHP behavior to retrieve a set of records ready for display in a tag-cloud kind of view.
Installing
1. Copy cloud.php to app/models/behaviors/
2. Find the model you intend to use this with and add a configuration similar to this to it:
class AppModel extends Model{
var $actsAs = array('Cloud' => array(
'countField' => 'count',
'query' => array('limit' => 50, 'contain' => false, 'order' => array('Tag.count' => 'DESC')),
));
}
Usage / Docs
To display the records you are interested in as a cloud, all you need to do is query them inside your controller:
$tags = $this->Tag->find('cloud');
$this->set(compact('tags'));
And render them in your view similar to this:
<h3>Tag Cloud</h3>
<?php
$out = array();
foreach ($tags as $tag) {
$size = 10 * $tag['Tag']['scale'];
$out[] = $html->link(
$tag['Tag']['name'],
array('controller' => 'tags', 'action' => 'view', $tag['Tag']['id']),
array('style' => 'font-size: '.$size.'px;')
);
}
echo join(', ', $out);
?>
Known Bugs
None







