Created
January 14, 2012 15:07
-
-
Save bastianallgeier/1611743 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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