{{pageindexbyletter letter="A"}}
/actions/pageindexbyletter.php
<?php
if ($pages = $this->LoadAllPages())
{
if (isset($_REQUEST["letter"])) $requested_letter = $_REQUEST["letter"];
else $requested_letter = '';
if (!$requested_letter && isset($letter)) $requested_letter = strtoupper($letter);
$link = $this->href("", "", "letter=");
$index_header = "<strong><a href='$link'>All </a></strong> \n";
$index_output = "";
$current_character = "";
$character_changed = false;
foreach ($pages as $page)
{
// $this->CachePage($page);
$firstChar = strtoupper($page["tag"][0]);
if (!preg_match("/[A-Za-z]/", $firstChar)) $firstChar = "#";
if ($this->config["hide_locked"]) $access = $this->HasAccess("read",$page["tag"]);
else $access = true;
if ($access)
{
if ($firstChar != $current_character) {
$index_header .= "<strong><a href='$link$firstChar'>$firstChar</a></strong> \n";
$current_character = $firstChar;
$character_changed = true;
}
if ($requested_letter == '' || $firstChar == $requested_letter) {
if ($character_changed) {
$index_output .= "<br />\n<strong>$firstChar</strong><br />\n";
$character_changed = false;
}
$index_output .= $this->Link("/".$page["tag"],"",$page["tag"]);
$index_output .= " . . . . . . . . . . . . . . . . <small>".$this->Link("/".$page["owner"],"",$page["owner"]);
$index_output .= "</small><br />\n";
}
}
}
$index_header .= "<br />";
print $index_header.$index_output;
} else {
print("<em>No pages found.</em>");
}
?>