Clickable subjects.
This commit is contained in:
4
TODO.md
4
TODO.md
@ -9,10 +9,10 @@ In no particular order, here is a semi-current list of things to be done in Info
|
||||
|
||||
[ ] Add a citation generator (Chicago, APA, MLA)
|
||||
|
||||
[ ] Item pages - Add clickable links on Subjects
|
||||
|
||||
[ ] Add share button/link on item page
|
||||
|
||||
[x] Item pages - Add clickable links on Subjects
|
||||
|
||||
[x] Item pages - Add clickable links on Series
|
||||
|
||||
[x] Menu - change categories to media types and hook to latest list
|
||||
|
@ -251,7 +251,8 @@ while ($row = $series->fetchArray()) {
|
||||
echo '<strong>Subjects: </strong>';
|
||||
while ($row = $tags->fetchArray()) {
|
||||
$row_tags = $row['name'];
|
||||
echo '['.$row_tags.'] ';
|
||||
//echo '['.$row_tags.'] ';
|
||||
echo '[<a href="results.php?su='.$row_tags.'">'.$row_tags.'</a>]';
|
||||
}
|
||||
echo '<br/ ><strong>Identifiers: </strong><br />';
|
||||
while ($row = $identifiers->fetchArray()) {
|
||||
|
35
results.php
35
results.php
@ -7,11 +7,13 @@ $keywordsearch = htmlspecialchars($_GET["kw"]);
|
||||
$authorsearch = htmlspecialchars($_GET["au"]);
|
||||
$typesearch = htmlspecialchars($_GET["ty"]);
|
||||
$seriessearch = htmlspecialchars($_GET["se"]);
|
||||
$subjectsearch = htmlspecialchars($_GET["su"]);
|
||||
|
||||
$socialkw = mb_convert_case($keywordsearch, MB_CASE_TITLE, "UTF-8");
|
||||
$socialau = mb_convert_case($authorsearch, MB_CASE_TITLE, "UTF-8");
|
||||
$socialty = mb_convert_case($typesearch, MB_CASE_TITLE, "UTF-8");
|
||||
$socialse = mb_convert_case($seriessearch, MB_CASE_TITLE, "UTF-8");
|
||||
$socialsu = mb_convert_case($subjectsearch, MB_CASE_TITLE, "UTF-8");
|
||||
|
||||
if (!empty($keywordsearch)) {
|
||||
$searchtopic = 'Keyword: '.$socialkw;
|
||||
@ -19,8 +21,10 @@ if (!empty($keywordsearch)) {
|
||||
$searchtopic = 'Author: '.$socialau;
|
||||
} elseif (!empty($typesearch)) {
|
||||
$searchtopic = 'Type: '.$socialty;
|
||||
} else {
|
||||
} elseif (!empty($seriessearch)) {
|
||||
$searchtopic = 'Series: '.$socialse;
|
||||
} else {
|
||||
$searchtopic = 'Subject: '.$socialsu;
|
||||
}
|
||||
|
||||
// -------------------- BEGIN DATABASE QUERIES --------------------
|
||||
@ -86,6 +90,20 @@ series ON series.id = books_series_link.series
|
||||
WHERE series.name = '$seriessearch'
|
||||
ORDER BY books.series_index ASC");
|
||||
|
||||
$subjectquery = $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 tags.name = '$subjectsearch'
|
||||
ORDER BY books.title ASC");
|
||||
|
||||
$types = $db->query("SELECT
|
||||
value
|
||||
FROM custom_column_1
|
||||
@ -137,9 +155,12 @@ ORDER BY value ASC");
|
||||
} elseif (!empty($typesearch)) {
|
||||
echo '<meta property="og:url" content="'.$SiteURL.'/results.php?ty='.$socialty.'" />';
|
||||
echo '<meta name="twitter:url" content="'.$SiteURL.'/results.php?ty='.$socialty.'" />';
|
||||
} else {
|
||||
} elseif (!empty($seriessearch)) {
|
||||
echo '<meta property="og:url" content="'.$SiteURL.'/results.php?ty='.$socialse.'" />';
|
||||
echo '<meta name="twitter:url" content="'.$SiteURL.'/results.php?ty='.$socialse.'" />';
|
||||
} else {
|
||||
echo '<meta property="og:url" content="'.$SiteURL.'/results.php?ty='.$socialsu.'" />';
|
||||
echo '<meta name="twitter:url" content="'.$SiteURL.'/results.php?ty='.$socialsu.'" />';
|
||||
}
|
||||
?>
|
||||
|
||||
@ -279,12 +300,20 @@ ORDER BY value ASC");
|
||||
|
||||
echo '<p style="padding:25px 0 35px 0;"><img style="float:left; max-height: 120px; padding: 10px 10px" src="images/'.$row_id.'.jpg"><strong><em><a href="itemrecord.php?itemid='.$row_id.'">'.$row_title.'</em></a> :</strong> '.strip_tags($row_excerpt).'...</p>';
|
||||
}
|
||||
} else {
|
||||
} elseif ($seriessearch != '') {
|
||||
while ($row = $seriesquery->fetchArray()) {
|
||||
$row_id = $row['id'];
|
||||
$row_title = $row['title'];
|
||||
$row_excerpt = $row['excerpt'];
|
||||
|
||||
echo '<p style="padding:25px 0 35px 0;"><img style="float:left; max-height: 120px; padding: 10px 10px" src="images/'.$row_id.'.jpg"><strong><em><a href="itemrecord.php?itemid='.$row_id.'">'.$row_title.'</em></a> :</strong> '.strip_tags($row_excerpt).'...</p>';
|
||||
}
|
||||
} else {
|
||||
while ($row = $subjectquery->fetchArray()) {
|
||||
$row_id = $row['id'];
|
||||
$row_title = $row['title'];
|
||||
$row_excerpt = $row['excerpt'];
|
||||
|
||||
echo '<p style="padding:25px 0 35px 0;"><img style="float:left; max-height: 120px; padding: 10px 10px" src="images/'.$row_id.'.jpg"><strong><em><a href="itemrecord.php?itemid='.$row_id.'">'.$row_title.'</em></a> :</strong> '.strip_tags($row_excerpt).'...</p>';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user