@davidm: To sort the help items alphabetically, you could try this:
if ($handle = opendir('help')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$help[] = $file;
}
}
closedir($handle);
}
natcasesort($help);
foreach($help as $k=>$v) {
$helpname = substr($v, 0, strrpos($v, '.'));
$helpname = str_replace('_', ' ', $helpname);
echo '<div class="tab-page" id="tab'.$v.'Help">';
echo '<h2 class="tab">'.$helpname.'</h2>';
echo '<script type="text/javascript">tpResources.addTabPage( document.getElementById( "tab'.$v.'Help" ) );</script>';
include "./help/$v";
echo '</div>';
}
Basically just build an array while looping through the directory, and sort it later.
If you wanted a custom tab-order, you could name your files with a two-digits prefix: 01Documents.php, 02FileUploads.php, 03Blog.php etc.
Then just sort by filenames, but strip out the first two characters for the tab-display.
i.e.
foreach($help as $k=>$v) {
$helpname = substr($v, 0, strrpos($v, '.'));
$helpname = substr($helpname, 2, strlen($helpname)-1 ); // strip out first two chars
$helpname = str_replace('_', ' ', $helpname);