Plugins in Fcp.Website are simply chunks of code to copy-and-paste at the end of the configuration file. In recent versions you can also include() them directly from the plugin directory.
Breadcrumbs
This plugin gives you a %%breadcrumbs%% template variable.
<?php
function breadcrumbs_box($location, $tpl_vars) {
global $CONTENT_DIR;
$depth = count($location['data']);
$pages = page_list($CONTENT_DIR);
if ($depth == 0) {
$location['data'][0] = $pages[0];
$depth = 1;
}
$base_url = $tpl_vars['self'] . '/page:';
$output = "<ul>\n";
for ($i = 0; $i < $depth; $i++) {
$path = join(':', array_slice($location['data'], 0, $i + 1));
$label = $location['data'][$i];
$output .= sprintf('<li><a href="%s">%s</a></li>',
$base_url . $path, $label);
}
$output .= "</ul>\n";
return $output;
}
$BOXES[] = 'breadcrumbs';
?>
Upper level page listing
This plugin gives you a template variable called %%uplevel%% which is replaced by a list of the pages on the level above the current one. The page list doesn't show up on the top level, where it would make no sense, nor on the second level, where it would be redundant.
<?php
/// Render list of pages on the level above the current page.
function uplevel_box($location, $tpl_vars) {
global $CONTENT_DIR;
if (count($location['data']) <= 2) {
// Don't show uplevel box on first two levels, it's redundant.
return '';
} else {
array_pop($location['data']);
$active = array_pop($location['data']);
}
$page_dir = implode(
DIRECTORY_SEPARATOR,
array_merge(array($CONTENT_DIR), $location['data']));
if (is_dir($page_dir) && is_readable($page_dir)) {
return page_list2html(
page_list($page_dir), $active, $location['data']);
}
}
$BOXES[] = 'uplevel';
?>
Lower level page listing
Like the above, but for pages below the current one. This box shows up all the time.
<?php
function subpages_box($location, $tpl_vars) {
global $CONTENT_DIR;
if (count($location['data']) == 0) {
$pages = page_list($CONTENT_DIR);
$location['data'][] = $pages[0];
}
$page_dir = implode(
DIRECTORY_SEPARATOR,
array_merge(array($CONTENT_DIR), $location['data']));
if (is_dir($page_dir) && is_readable($page_dir)) {
return page_list2html(
page_list($page_dir), null, $location['data']);
}
}
$BOXES[] = 'subpages';
?>
(Syntax highlighting courtesy of JUSH.)