Added subtypes to items and results.
This commit is contained in:
@ -138,8 +138,8 @@ INNER JOIN
|
||||
books_custom_column_2_link
|
||||
ON books_custom_column_2_link.book = books.id
|
||||
INNER JOIN
|
||||
custom_column_2 ON
|
||||
custom_column_2.id = books_custom_column_2_link.value
|
||||
custom_column_2
|
||||
ON custom_column_2.id = books_custom_column_2_link.value
|
||||
WHERE
|
||||
books.id = '$ItemID'");
|
||||
|
||||
@ -147,7 +147,22 @@ while ($row = $publisher_location->fetchArray()) {
|
||||
$row_publocation = $row['publoc'];
|
||||
}
|
||||
|
||||
// ---------- Pull subtype information ----------
|
||||
|
||||
$subtype = $db->query("SELECT custom_column_3.value AS subtype
|
||||
FROM books
|
||||
INNER JOIN
|
||||
books_custom_column_3_link
|
||||
ON books_custom_column_3_link.book = books.id
|
||||
INNER JOIN
|
||||
custom_column_3
|
||||
ON custom_column_3.id = books_custom_column_3_link.value
|
||||
WHERE
|
||||
books.id = '$ItemID'");
|
||||
|
||||
while ($row = $subtype->fetchArray()) {
|
||||
$row_subtype = $row['subtype'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -369,6 +384,7 @@ while ($row = $publisher_location->fetchArray()) {
|
||||
echo '<strong>Location:</strong> '.$row_publocation.'<br />';
|
||||
echo '<strong>Date: </strong>'.$row_pubdate.'<br />';
|
||||
echo '<strong>Type: </strong> <a href="results.php?ty='.$row_type.'">'.$row_type.'</a><br />';
|
||||
echo '<strong>Subtype: </strong> <a href="results.php?st='.$row_subtype.'">'.$row_subtype.'</a><br />';
|
||||
echo '<strong>Subjects: </strong>';
|
||||
while ($row = $tags->fetchArray()) {
|
||||
$row_tags = $row['name'];
|
||||
|
43
results.php
43
results.php
@ -6,12 +6,14 @@ include_once "settings.php";
|
||||
$keywordsearch = htmlspecialchars($_GET["kw"]);
|
||||
$authorsearch = htmlspecialchars($_GET["au"]);
|
||||
$typesearch = htmlspecialchars($_GET["ty"]);
|
||||
$subtypesearch = htmlspecialchars($_GET["st"]);
|
||||
$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");
|
||||
$socialst = mb_convert_case($subtypesearch, 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");
|
||||
|
||||
@ -23,8 +25,10 @@ if (!empty($keywordsearch)) {
|
||||
$searchtopic = 'Type: '.$socialty;
|
||||
} elseif (!empty($seriessearch)) {
|
||||
$searchtopic = 'Series: '.$socialse;
|
||||
} else {
|
||||
} elseif (!empty($subjectsearch)) {
|
||||
$searchtopic = 'Subject: '.$socialsu;
|
||||
} else {
|
||||
$searchtopic = 'Subtype: '.$socialst;
|
||||
}
|
||||
|
||||
// -------------------- BEGIN DATABASE QUERIES --------------------
|
||||
@ -76,6 +80,21 @@ WHERE
|
||||
custom_column_1.value = '$typesearch'
|
||||
ORDER BY books.title ASC");
|
||||
|
||||
$subtypequery = $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_custom_column_3_link ON books_custom_column_3_link.book = books.id
|
||||
INNER JOIN
|
||||
custom_column_3 ON custom_column_3.id = books_custom_column_3_link.value
|
||||
WHERE
|
||||
custom_column_3.value = '$subtypesearch'
|
||||
ORDER BY books.title ASC");
|
||||
|
||||
$seriesquery = $db->query("SELECT
|
||||
DISTINCT books.id AS id,
|
||||
books.title AS title,
|
||||
@ -109,6 +128,11 @@ value
|
||||
FROM custom_column_1
|
||||
ORDER BY value ASC");
|
||||
|
||||
$subtypes = $db->query("SELECT
|
||||
value
|
||||
FROM custom_column_3
|
||||
ORDER BY value ASC");
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@ -158,9 +182,12 @@ ORDER BY value ASC");
|
||||
} 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 {
|
||||
} elseif (!empty($subjectsearch)) {
|
||||
echo '<meta property="og:url" content="'.$SiteURL.'/results.php?ty='.$socialsu.'" />';
|
||||
echo '<meta name="twitter:url" content="'.$SiteURL.'/results.php?ty='.$socialsu.'" />';
|
||||
} else {
|
||||
echo '<meta property="og:url" content="'.$SiteURL.'/results.php?ty='.$socialst.'" />';
|
||||
echo '<meta name="twitter:url" content="'.$SiteURL.'/results.php?ty='.$socialst.'" />';
|
||||
}
|
||||
?>
|
||||
|
||||
@ -308,7 +335,7 @@ 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 ($subjectsearch != '') {
|
||||
while ($row = $subjectquery->fetchArray()) {
|
||||
$row_id = $row['id'];
|
||||
$row_title = $row['title'];
|
||||
@ -316,7 +343,15 @@ 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 {
|
||||
while ($row = $subtypequery->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>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user