Skip to content

Instantly share code, notes, and snippets.

@bastianallgeier
Created January 14, 2012 15:07
Show Gist options
  • Save bastianallgeier/1611743 to your computer and use it in GitHub Desktop.
Save bastianallgeier/1611743 to your computer and use it in GitHub Desktop.
<?php
$blog = $pages->find('blog');
$index = $blog->children()->index();
$cloud = array();
foreach($index as $p) {
$tags = str::split((string)$p->tags());
foreach($tags as $t) {
if(isset($cloud[$t])) {
$cloud[$t]++;
} else {
$cloud[$t] = 1;
}
}
}
a::show($cloud);
/* example output:
Array
(
[design] => 2
[fun] => 1
[awesome] => 1
[photography] => 2
[text] => 1
[cats] => 1
)
*/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment