From b01ad1d9123ab8f497ce78fcab0c5caebc0cc993 Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Tue, 20 Mar 2018 12:08:43 -0400 Subject: * Allow sorting by bible book and by key --- index.php | 4 +++- page.php | 11 ++++++++++- sort.php | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 sort.php diff --git a/index.php b/index.php index bc25f51..9520ed3 100755 --- a/index.php +++ b/index.php @@ -85,7 +85,9 @@ include 'page.php'; $song_number = isset( $_GET['song'] ) ? $_GET['song'] : ''; if( ! $song_number ) { - echo toc(); + $sort = ''; + if ( isset( $_GET['sort'] ) ) $sort = $_GET['sort']; + echo toc($sort); } else { diff --git a/page.php b/page.php index d710b28..94d0317 100644 --- a/page.php +++ b/page.php @@ -8,7 +8,7 @@ /** * @brief Go through the file inputfile.txt and return each song with a link to it. */ -function toc(){ +function toc( $sort ){ $handle = fopen("inputfile.txt", "r"); $entries = array(); $number = 0; @@ -42,6 +42,15 @@ function toc(){ } $toc = '
'; $toc .= '