本文整理汇总了PHP中search::initiateCategories方法的典型用法代码示例。如果您正苦于以下问题:PHP search::initiateCategories方法的具体用法?PHP search::initiateCategories怎么用?PHP search::initiateCategories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类search
的用法示例。
在下文中一共展示了search::initiateCategories方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: outputPageSearchResult
private static function outputPageSearchResult($searchResults, $rootUri)
{
$pageResultList = "";
if (count($searchResults) == 0) {
return "";
}
$pageResultList .= " <ol id='os_results' start='" . $GLOBALS["start"] . "'>\r\n";
for ($x = $GLOBALS["start"] - 1; $x < $GLOBALS["end"]; $x++) {
$r_number = $x + 1;
$r_relevance = sprintf("%01.1f", $searchResults[$x]["relevance"]);
$r_filetype = !in_array($searchResults[$x]["filetype"], array("html", "txt")) ? "[" . $searchResults[$x]["filetype"] . "]" : "";
$r_title = $searchResults[$x]["title"];
if (!$searchResults[$x]["title"]) {
$puri = @parse_url($searchResults[$x]["uri"]);
if (isset($puri["path"])) {
$r_title = basename($puri["path"]);
}
if (strlen($r_title) <= 3) {
$r_title = htmlspecialchars(str_replace(array($rootUri, "http://"), array("/", ""), $searchResults[$x]["uri"]));
}
}
// // With leading server
// $r_uri =
// str_replace(array($rootUri, "http://{$_SERVER["HTTP_HOST"]}/"),
// array("", "/"),
// $searchResults[$x]["uri"]);
// Without leading server or /
$r_uri = str_replace(array($rootUri, URL_PREFIX, "http://" . $_SERVER["HTTP_HOST"] . "/", "http://www.nordita.org/", "http://", "/index.php"), array("", "", "", "", "", ""), $searchResults[$x]["uri"]);
// Should already be taken care of in getPageSearch():
$r_matchuri = str_replace(array($rootUri, URL_PREFIX, "http://" . $_SERVER["HTTP_HOST"] . "/", "http://www.nordita.org/", "http://", "/index.php"), array("/", "/", "/", "/", "", ""), $searchResults[$x]["matchURI"]);
if (empty($r_matchuri)) {
$r_matchuri = "/";
}
if (!isset($GLOBALS["nw_categories"])) {
$GLOBALS["nw_categories"] = search::initiateCategories($GLOBALS["searchClass"]->table);
}
$r_category = count($GLOBALS["nw_categories"]) > 1 && strtolower($searchResults[$x]["category"]) != "main" ? "<span class='gray'>[in the <a href='" . strip_tags(strtolower($searchResults[$x]["category"])) . "/index.php'><em>" . htmlspecialchars($searchResults[$x]["category"]) . "</em></a> subsite]</span>" : "";
$r_description = $searchResults[$x]["description"] != "NORDITA - Nordic Institute for Theoretical Physics" ? $searchResults[$x]["description"] : "";
$r_match = $searchResults[$x]["matchText"] != "NORDITA - Nordic Institute for Theoretical Physics" ? $searchResults[$x]["matchText"] : "";
$pageResultList .= " <li>\r\n" . " <p class='os_resulttitle'>" . "<a href='" . URL_PREFIX . $r_uri . "' title='" . $r_description . "'>" . $r_title . "</a></p>\r\n" . " <p>\r\n" . " <span class='os_resultmatchuri'>" . $r_matchuri . "</span>\r\n" . (!empty($r_filetype) ? " <span class='os_resultfiletype'>" . $r_filetype . "</span>\r\n" : "") . (!empty($r_category) ? " <span class='os_resultcategory'>" . $r_category . "</span>\r\n" : "") . " </p>\r\n" . " <p class='os_resultinfo'>" . (!empty($r_description) && empty($r_match) ? $r_description : "") . $r_match . "</p>\r\n" . (IS_TESTSERVER ? " <p class='os_resultrelevance'>(" . $r_relevance . ")</p>\r\n" : "") . " </li>\r\n";
}
// end for
$pageResultList .= " </ol>\r\n" . "\r\n";
return trim($pageResultList);
}
示例2: array
// Sort categories array in logical rather than alphabetical order:
$ctemp = array();
foreach (array("Main","Guests","Organizers","Nordic","Intranet","Newstaff","Administrators","Board") as $mycat) {
$key = array_search($mycat,$_SDATA["categories"]);
if ($key !== false) {
$ctemp[] = $mycat;
unset($_SDATA["categories"][$key]);
}
}
$_SDATA["categories"] = array_merge($ctemp,$_SDATA["categories"]);
*/
// --------------------
// -- Assemble array with analyzed query data from GPC string
// --> $GLOBALS["QUERY"]
// --------------------
$GLOBALS["nw_categories"] = search::initiateCategories($_DDATA["tablename"]);
search::initiateQueryParameters();
$GLOBALS["QUERY"] = search::analyzeQuery($GLOBALS["qry"], $GLOBALS["ctg"]);
/*
// --------------------
// -- Create cagegory GPC variable if it was not sent
// --> $_REQUEST['ctg']
// --------------------
$_REQUEST['ctg'] = (isset($_REQUEST['ctg'])) ?
$_REQUEST['ctg']
: ( (in_array(ucfirst(SUBSITE),$_SDATA["categories"])) ? ucfirst(SUBSITE) : "" );
if (!in_array($_REQUEST['ctg'], $_SDATA["categories"])) $_REQUEST['ctg'] = "";
*/
// --------------------