Backend for songs.zachdecook.com
* Table of contents: add title sort
| -rw-r--r-- | page.php | 3 | ||||
| -rw-r--r-- | sort.php | 5 |
2 files changed, 8 insertions, 0 deletions
@@ -50,6 +50,9 @@ function toc( $sort ){ else if ( $sort == 'verse' ){ usort( $entries, 'tocBooksort' ); } + else if ( $sort == 'title' ){ + usort( $entries, 'tocTitlesort' ); + } } foreach( $entries as $item ){ $toc .= tocentry($item); @@ -6,6 +6,11 @@ function tocKeysort( $a, $b ){ return ord($aKey[0]) - ord($bKey[0]); } +function tocTitleSort( $a, $b ){ + $aTitle = $a['title']; + $bTitle = $b['title']; + return strcmp( $aTitle, $bTitle ); +} function tocBooksort( $a, $b ){ $bookOrder = array( |