Welcome to the Dojo Toolkit Demo Index
array thing I can do here?
foreach($ext->external as $e){
$out[] = array(
"demo" => $e->demo,
"link" => $e->link,
"img" => $e->img,
"rank" => $e->rank,
"header" => $e->header
);
}
}
$exclude = array("resources", ".", "..", ".svn");
$files = scandir("./");
foreach($files as $demo){
if(is_dir($demo) && !in_array($demo, $exclude)){
// setup some item information
$title = $demo;
$rank = 500;
$base = $demo . "/";
$link = $base;
$readme = $base . "README";
if(file_exists($readme)){
// the second line of the README is the title
$l = file($readme);
$title = $l[1];
// demos with README's are better than those without.
$rank++;
// the last line of the README is supposed to be tags etc
//
// so far only @rank:### is used, but can be any @key:value pair on one line
// to be used here for organization etc
$tagline = $l[count($l)-1];
preg_match_all("/@(\w+):([\-a-zA-Z0-9]+)\ ?/", $tagline, $matches);
if(is_array($matches[1]) && is_array($matches[2])){
$tags = array_combine($matches[1], $matches[2]);
}else{
$tags = array();
}
switch($tags['rank']){
// marked experimental
case -999 : $rank = 0; break;
// add the README rank to the overall score
default: $rank += $tags['rank']; break;
}
// with a thumbnail, they are higher ranked too
$thumb_img = "resources/images/" . $demo . ".png";
if(file_exists($thumb_img)){
$rank += 20;
}else{
$thumb_img = "resources/images/no_thumb.gif"; // generic dojo img
}
}else{
// experimental demos:
$rank = 0;
$thumb_img = false;
}
// push this item
$out[] = array(
"demo" => $demo,
"header" => $title,
"link" => $link,
"rank" => $rank,
"img" => $thumb_img
);
}
}
// sort the out array by the ranks key
foreach ($out as $key => $row) {
$ranks[$key] = $row['rank'];
$d[$key] = $row;
}
array_multisort($ranks, SORT_DESC, $d, SORT_ASC, $out);
// generate the list:
print "
";
$in_experimental = false;
foreach($out as $ranked){
if($ranked['rank'] === 0 && !$in_experimental){
// we're done with top demos, close list and make a new one
$in_experimental = true;
print "
";
print "
Incomplete / Partial Demos:
";
print "
";
?>
Additional external demos can be found on the Key Links index