<?php

/**
 * Architect Template: Display the skyscrapers associated with an architect
 *
 */
$browserTitle = $page->title . " Skyscrapers";
$headline = $page->title;
$content = renderSkyscraperList(findSkyscrapers("architects={$page}"));
<?php

/**
 * City Template: Display all the skyscrapers in a given city
 *
 * This just lists the current page's children, which are assumed to be skyscrapers
 *
 */
$browserTitle = "Skyscrapers in " . $page->title;
$headline = $page->title . " Skyscrapers";
$content = renderSkyscraperList(findSkyscrapers("parent={$page}"));
        } else {
            $value = (int) $value;
            $selector .= "{$key}={$value}, ";
            $summary[$key] = $value;
            $input->whitelist($key, $value);
        }
    }
}
// if there are keywords, look in the title and body fields for the words
if ($input->get->keywords) {
    $value = $sanitizer->selectorValue($input->get->keywords);
    $selector .= "title|body%={$value}, ";
    $summary["keywords"] = $sanitizer->entities($value);
    $input->whitelist('keywords', $value);
}
// display a summary of what was searched for above the search results
$content = "<ul id='search_summary'>";
$browserTitle = "Skyscrapers - ";
foreach ($summary as $key => $value) {
    if (!$value) {
        continue;
    }
    $key = ucfirst($key);
    $content .= "\n\t<li><strong>{$key}:</strong> {$value}</li>";
    $browserTitle .= "{$key}: {$value}, ";
}
$content .= "\n</ul>";
// compile final output
$content .= renderSkyscraperList(findSkyscrapers($selector));
$browserTitle = rtrim($browserTitle, ", ");
$headline = "Skyscraper Search";
<?php

/**
 * Outputs list of all skyscrapers, regardless of city
 *
 */
$content = renderSkyscraperList(findSkyscrapers(''));
<?php

/**
 * Homepage template
 *
 */
$headline = "United States Skyscrapers";
$browserTitle = $headline;
$content = '';
// display a random photo from this page
if ($photo = $page->images->getRandom()) {
    $photo = $photo->size(640, 300);
    $content .= "<p><img src='{$photo->url}' alt='{$photo->description}' /></p>";
}
// intro copy
$content .= $page->body;
// generate a list of featured skyscrapers.
$skyscrapers = $page->skyscrapers->find("limit=3, sort=random");
$content .= "\n<h3>Featured Skyscrapers</h3>" . renderSkyscraperList($skyscrapers, false);
// provide a list of all cities where they can start browsing skyscrapers
$content .= "\n<h3>Skyscrapers by City</h3>" . $pages->get("/cities/")->children()->render();