github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

felixge / debuggable-scraps

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 60
    • 10
  • Source
  • Commits
  • Network (10)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (3)
    • devel
    • gh-pages
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

MIT licensed code without warranty ; ) — Read more

  cancel

http://www.debuggable.com/

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Caching the returned value for even faster future lookups 
josegonzalez (author)
Tue Feb 09 01:04:32 -0800 2010
Felix Geisendörfer (committer)
Tue Feb 09 01:18:27 -0800 2010
commit  5d79cc93bd35125eef52244f41c9c966dae43dd9
tree    77ce062a67a0d5f47f0b1aa69e5368ba59a7f246
parent  3fbfca1bd3205e78aac80414bb8e8556a40496ae
debuggable-scraps / cakephp / behaviors / cloud
name age
history
message
..
file cloud.php Loading commit data...
file readme.textile Fri Sep 05 05:21:53 -0700 2008 Fixed typo in cloud behavior readme [Felix Geisendörfer]
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

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server