Page Title for Results
Add a page title to the results page based on Category name, Secondary name, or keywords field
At the top of results.php (or your results page), but below the application.php include, add this code:
<?php
$urlkeywords = (isset($_GET["keywords"])) ? $_GET["keywords"] : "";
$urlcategory = (isset($_GET["category"])) ? $_GET["category"] : "";
$urlsecondary = (isset($_GET["secondary"])) ? $_GET["secondary"] : "";
$query_rsCWGetCategory = sprintf("SELECT category_Name
FROM tbl_prdtcategories
WHERE category_archive = 0
AND category_ID = %d",intval($urlcategory));
$rsCWGetCategory = $cartweaver->db->executeQuery($query_rsCWGetCategory);
$row_rsCWGetCategory = $cartweaver->db->db_fetch_assoc($rsCWGetCategory);
$rsCWGetCategory_recordCount = $cartweaver->db->recordCount;
$query_rsCWSecondaryCategory = sprintf("SELECT scndctgry_Name
FROM tbl_prdtscndcats
WHERE scndctgry_Archive = 0
AND scndctgry_ID = %d",intval($urlsecondary));
$rsCWSecondaryCategory = $cartweaver->db->executeQuery($query_rsCWSecondaryCategory);
$row_rsCWSecondaryCategory = $cartweaver->db->db_fetch_assoc($rsCWSecondaryCategory);
$rsCWSecondaryCategory_recordCount = $cartweaver->db->recordCount;
$pageTitle = "Search Results";
if($rsCWGetCategory_recordCount > 0) {
$pageTitle .= " Product Category: " . $row_rsCWGetCategory["category_Name"];
}
if($rsCWSecondaryCategory_recordCount > 0) {
$pageTitle .= " Product Secondary: " . $row_rsCWSecondaryCategory["scndctgry_Name"];
}
if($urlkeywords != "") {
$pageTitle .= " Keywords: " . $urlkeywords;
}
?>
Then add the pageTitle to your title tag:
<title><?php echo($pageTitle);?></title>