From 1ae30b499f5e304603efcc1da87fcef063f1ffe3 Mon Sep 17 00:00:00 2001 From: Daniel Messer Date: Thu, 3 Aug 2023 11:36:48 -0500 Subject: [PATCH] Clickable authors and new results.php. --- TODO.md | 4 ++- index.php | 2 +- itemrecord.php | 2 +- keywordresults.php => results.php | 56 ++++++++++++++++++++++++++----- 4 files changed, 53 insertions(+), 11 deletions(-) rename keywordresults.php => results.php (79%) diff --git a/TODO.md b/TODO.md index 2f2260e..9c15396 100644 --- a/TODO.md +++ b/TODO.md @@ -7,7 +7,7 @@ In no particular order, here is a semi-current list of things to be done in Info [ ] Add an About page -[ ] Item pages - Add clickable links on Creator +[ ] Add a citation generator (Chicago, APA, MLA) [ ] Item pages - Add clickable links on Series @@ -21,6 +21,8 @@ In no particular order, here is a semi-current list of things to be done in Info [ ] Add image (mostly Pixabay) credits +[x] Item pages - Add clickable links on Creator + [x] Item pages - Add clickable links on Identifiers [x] Add link to project repo diff --git a/index.php b/index.php index 0fe2996..2a966cd 100644 --- a/index.php +++ b/index.php @@ -127,7 +127,7 @@ LIMIT 4');

Search

-
+
diff --git a/itemrecord.php b/itemrecord.php index 1f3e86b..a90f832 100644 --- a/itemrecord.php +++ b/itemrecord.php @@ -240,7 +240,7 @@ while ($row = $series->fetchArray()) { Item Control Number: '.$ItemID.'
'; echo 'Title: '.$row_title.'
'; - echo 'Creator: '.$row_author_sort.'
'; + echo 'Creator: '.$row_author_sort.'
'; if ($row_series) { echo 'Series: '.$row_series.'
'; echo 'Series Index: '.$row_seriesindex.'
'; diff --git a/keywordresults.php b/results.php similarity index 79% rename from keywordresults.php rename to results.php index 259d57f..5b380db 100644 --- a/keywordresults.php +++ b/results.php @@ -4,8 +4,16 @@ include_once "settings.php"; // Get and use a basic title search for pulling records. $keywordsearch = htmlspecialchars($_GET["kw"]); +$authorsearch = htmlspecialchars($_GET["au"]); $socialkw = mb_convert_case($keywordsearch, MB_CASE_TITLE, "UTF-8"); +$socialau = mb_convert_case($authorsearch, MB_CASE_TITLE, "UTF-8"); + +if (empty($keywordsearch)) { + $searchtopic = $socialau; +} else { + $searchtopic = $socialkw; +} // -------------------- BEGIN DATABASE QUERIES -------------------- @@ -29,6 +37,20 @@ OR comments.text LIKE '%$keywordsearch%' OR tags.name LIKE '%$keywordsearch%' ORDER BY books.title ASC"); +$authorquery = $db->query("SELECT +DISTINCT books.id AS id, +books.title AS title, +SUBSTR(comments.text,0,120) AS excerpt +FROM books +INNER JOIN +comments ON comments.book = books.id +INNER JOIN +books_tags_link ON books_tags_link.book = books.id +INNER JOIN +tags ON tags.id = books_tags_link.tag +WHERE books.author_sort LIKE '%$authorsearch%' +ORDER BY books.title ASC"); + ?> @@ -40,7 +62,7 @@ ORDER BY books.title ASC"); - Infopump - Basic title search + Infopump - Search results - <?php echo $searchtopic; ?> @@ -61,21 +83,29 @@ ORDER BY books.title ASC"); --> - ';?> + ';?> ';?> - ';?> + '; + echo ''; + } else { + echo ''; + echo ''; + } + ?> - ';?> + ';?> ';?> - ';?> + ';?> ';?> - ';?> + @@ -137,7 +167,7 @@ ORDER BY books.title ASC");

Search

- +
@@ -159,7 +189,7 @@ ORDER BY books.title ASC");
  • -->
    @@ -175,6 +205,7 @@ ORDER BY books.title ASC");
    fetchArray()) { $row_id = $row['id']; $row_title = $row['title']; @@ -182,6 +213,15 @@ ORDER BY books.title ASC"); echo '

    '.$row_title.' : '.strip_tags($row_excerpt).'...

    '; } + } else { + while ($row = $authorquery->fetchArray()) { + $row_id = $row['id']; + $row_title = $row['title']; + $row_excerpt = $row['excerpt']; + + echo '

    '.$row_title.' : '.strip_tags($row_excerpt).'...

    '; + } + } ?>