本文整理汇总了PHP中Display::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Display::set方法的具体用法?PHP Display::set怎么用?PHP Display::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Display
的用法示例。
在下文中一共展示了Display::set方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
/**
* Display contact form
*/
function indexAction()
{
Display::set("adPage", "contact");
if (!Config::get("contactPageEnabled")) {
return $this->return404();
}
}
示例2: indexAction
/**
* Index page
*/
function indexAction()
{
//set adPage
Display::set("adPage", "index");
//set META description
$this->set("metaDescription", Config::get("siteDescription"));
$cache = Cacher::getInstance();
//retrieve predefinied html directoryDescription from db
if (($message = $cache->load("directoryDescription")) === null) {
$message = $this->customMessage->findByPk("directoryDescription")->toArray();
$cache->save($message, null, null, array("custommessage"));
}
$this->set("directoryDescription", $message);
}
示例3: showAllAction
function showAllAction()
{
if (!Config::get("allCategoriesPageEnabled")) {
return $this->return404();
}
Display::set("adPage", "allcategories");
//get all categories first parents then childs to build tree
$c = new Criteria();
$c->addOrder("parentCategoryId, name");
$categories = $this->category->findAll($c, "categoryId, parentCategoryId, name, urlName, validatedSitesCount");
$tree = new NavigationTree();
foreach ($categories as $category) {
$value = $category;
//add node to tree
$tree->addNode($category['categoryId'], $category['parentCategoryId'], $value);
}
//build tree
$this->set("allCategories", $tree->render());
}
示例4: showAction
/**
* Show keywords starting with letter
*/
function showAction($letter)
{
if (!Config::get('keywordsEnabled') || !preg_match("#^[A-Z0-9]\$#", $letter)) {
return $this->return404();
}
//set adPage for display
Display::set("adPage", "letter{$letter}");
$keywordGroups = array();
//retrieve keywors which start with $letter
$keywords = $this->keyword->getKeywordsWithPrefix($letter);
$keywordIds = array();
foreach ($keywords as $keyword) {
$keywordIds[] = $keyword['keywordId'];
}
//Count validated sites which contain keyword
$c = new Criteria();
$c->add("keywordId", $keywordIds, "IN");
$c->addGroup("keywordId");
$c->addInnerJoin("sites", "sites.siteId", "keywordsofsites.siteId");
$c->add("status", "validated");
$sitesCountsForKeyword = $this->keywordsOfSite->getArray($c, "count(*)", "keywordId");
//foreach keyword on this page check have many sites include it and push it to prefix group
foreach ($keywords as $keyword) {
//if some site have this keyword
if (isset($sitesCountsForKeyword[$keyword['keywordId']])) {
$keyword['count'] = $sitesCountsForKeyword[$keyword['keywordId']];
} else {
//if no set counter to default 0
$keyword['count'] = 0;
}
//if group for this prefix doesn't exists so far
if (!isset($keywordGroups[$keyword['prefix']]['keywords'])) {
//create group for this prefix
$keywordGroups[$keyword['prefix']]['keywords'] = array();
}
//add keyword to prefix group
$keywordGroups[$keyword['prefix']]['keywords'][] = $keyword;
}
$this->set("letter", $letter);
$this->set("keywordGroups", $keywordGroups);
}
示例5: searchAction
/**
* Display sites which containt searched phrase
*/
function searchAction($searchQuery = "")
{
//set adPage for ads
Display::set("adPage", "search");
Display::set("searchPanel", true);
$searchedItems = array();
$this->request->fromArray($_GET);
$searchValues = $this->request->toArray();
$this->set("searchValuesJson", JsonView::php2js($searchValues));
$page = !empty($this->request->page) ? $this->request->page : 1;
$resultsCount = 0;
//if something was searched
if (!empty($searchValues)) {
//get sites which containt searched phrase
$searchedItems = $this->siteSearcher->searchValidated($searchValues, $page);
$resultsCount = $this->siteSearcher->getFoundRowsCount();
//if this phrase have matched sites save tag
if (!empty($searchedItems) && !empty($this->request->phrase)) {
$this->searchTag->addSearchTag($this->request->phrase, $searchedItems[0]);
}
$this->set('searchValues', $searchValues);
//prepare data for pagination
$totalPages = empty($searchedItems) ? 0 : ceil($resultsCount / Config::get("sitesPerPageInSearch"));
} else {
//nothing was searched
$searchedItems = array();
$totalPages = 0;
$page = 1;
}
$this->set("resultsCount", $resultsCount);
$this->set("searchedSites", $searchedItems);
$searchArray = array();
foreach (explode("&", ltrim($searchQuery, "?")) as $searchPair) {
if (strpos($searchPair, "=") === false) {
continue;
}
list($key, $value) = explode("=", $searchPair);
if (!$value || in_array($key, array("page", "search"))) {
continue;
}
$searchArray[urldecode($key)] = urldecode($value);
}
$paginationBaseLink = "/site/search/?" . str_replace("%", "%%", http_build_query($searchArray)) . "&page=";
$this->set("pageNavigation", array("baseLink" => $paginationBaseLink, "totalPages" => $totalPages, "currentPage" => $page));
}
示例6: return404
protected function return404()
{
header('Status: 404 Not Found');
header('HTTP/1.0 404 Not Found');
$this->niceName = "front";
$this->viewFile = "404";
Display::set("adPage", "error404");
echo $this->render();
exit;
}
示例7: sqlQuery
/**
* Executes custom query
* @return resource MySQL result resource
*/
public function sqlQuery($sql)
{
if (!$this->connected) {
$this->connect();
$this->connected = true;
$this->sqlQuery("SET NAMES " . Config::get('DEFAULT_CHARSET'));
}
$startTime = microtime(true);
$res = mysql_query($sql);
$endTime = microtime(true);
$queryTime = $endTime - $startTime;
if ($this->debug) {
echo sprintf("%f", $queryTime) . "<br>";
echo "<b>" . $sql . "</b><br><br>";
}
$this->queriesCnt++;
$this->queriesTime += $queryTime;
Display::set("queriesCount", $this->queriesCnt);
Display::set("queriesTime", $this->queriesTime);
if (!$res) {
echo $sql;
$error = mysql_error();
$errornr = mysql_errno();
trigger_error("B³±d SQL {$error} ({$errornr})");
}
$this->lastInsertId = mysql_insert_id();
$this->lastAffectedRows = mysql_affected_rows();
return $res;
}