本文整理汇总了PHP中Common::parse_nav_pages方法的典型用法代码示例。如果您正苦于以下问题:PHP Common::parse_nav_pages方法的具体用法?PHP Common::parse_nav_pages怎么用?PHP Common::parse_nav_pages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Common
的用法示例。
在下文中一共展示了Common::parse_nav_pages方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_faq_search_server
function show_faq_search_server($params)
{
global $TDB, $TMS, $TPA, $REQUEST_ASSOC;
Common::call_common_instance('pages');
$pages =& pages_module_common::getInstance();
$TMS->AddFileSection(Common::get_fmodule_tpl_path('faq', $params["MTemplate"]));
if (isset($REQUEST_ASSOC['sl'])) {
$request = $_SESSION["faq"]["last_search"];
} else {
$request = urldecode($_POST["faqsearch"]);
}
if (!$request) {
return $TMS->parseSection('_no_request');
}
$_SESSION["faq"]["last_search"] = $request;
$words = explode(' ', $request);
$OM = array();
$sfields = array('question', 'answer', 'sanswer');
$first = true;
foreach ($words as $word) {
$value = trim(mysql_real_escape_string($word));
$cond = array();
foreach ($sfields as $sfield) {
$cond[] = " `" . $sfield . "` LIKE '%" . $value . "%' ";
}
$query = "SELECT `id` FROM `faq` WHERE (" . implode('OR', $cond) . ") AND `active`=1;";
$r = $TDB->get_results($query, 'ARRAY_N');
if (!count($r)) {
$TMS->AddReplace('_no_results', 'request', $request);
return $TMS->parseSection('_no_results');
}
$Mas = array();
foreach ($r as $v) {
$Mas[] = $v[0];
}
if ($first) {
$OM = $Mas;
} else {
$OM = array_intersect($OM, $Mas);
}
if (!count($OM)) {
$TMS->AddReplace('_no_results', 'request', $request);
return $TMS->parseSection('_no_results');
}
$first = false;
}
$sl = $REQUEST_ASSOC['sl'] ? (int) $REQUEST_ASSOC['sl'] : 0;
$dst = $pages->create_page_path($params["MDestination_page"]);
$total = count($OM);
if ($params["OnPage"] < $total && $params["OnPage"]) {
$OM = array_slice($OM, $sl, $params["OnPage"]);
Common::parse_nav_pages($total, $params["OnPage"], $sl, $TPA->page_link . '/~faqsearch');
}
$query = "SELECT * FROM `faq` WHERE `id` in ('" . implode("', '", $OM) . "');";
$questions = $TDB->get_results($query);
foreach ($questions as $question) {
$question["timestamp"] = strtotime($question["date"]);
$question["Link"] = $dst . "/~show_question/qid/" . $question["id"];
$question["Destination"] = $dst;
$TMS->AddMassReplace('_search_list_item', $question);
$TMS->parseSection('_search_list_item', true);
}
$TMS->AddMassReplace('_faq_search_results', array("total" => $total, "Destination" => $dst));
return $TMS->parseSection('_faq_search_results');
}
示例2: show_album
function show_album($params)
{
global $TMS, $HTTP_HOST, $REQUEST_VARS, $_WEBPATH, $_PATH, $TDB, $TPA;
if ($REQUEST_VARS[1]) {
$TDB->query("SELECT `id` FROM `_tree_gallery_container_struct` WHERE `basic`='" . mysql_real_escape_string($REQUEST_VARS[1]) . "';");
$r = $TDB->get_results();
$GalleryStart = $r[1]['id'];
/*
($params['GalleryStartId']) ? $anc = $this->_tree->GetAncestor($params['GalleryStartId']) : $anc=1;
$nodes=$this->_tree->FindbyBasic($anc,$REQUEST_VARS[1]);
$GalleryStart=$nodes[0];
*/
} else {
$GalleryStart = $params['GalleryStartId'];
}
if (!$GalleryStart) {
return;
}
if ($REQUEST_VARS[2] == null) {
$sl = 0;
} else {
$sl = $REQUEST_VARS[2];
}
if (!$GalleryStart) {
return;
}
$album = $this->_tree->GetNodeInfo($GalleryStart);
$album["params"]["id"] = $album["id"];
$album["params"]["_ARES"] = $_PATH['WEB_PATH_ARES'];
$album["params"]["start"] = $sl + 1;
if ($params['MTemplate']) {
$params['Template'] = $params['MTemplate'];
}
if (!$params["Levels"]) {
$params["Levels"] = $album["params"]["counter"];
}
if ($params["rows"]) {
$params["max_rows"] = $params["rows"];
}
if (!$params["max_rows"]) {
$params["max_rows"] = ceil($album["params"]["counter"] / $params["Levels"]);
}
$onPage = intval($params["max_rows"] * $params["Levels"]);
$total = intval($album["params"]["counter"]);
$template = Common::get_fmodule_tpl_path('gallery', $params['Template']);
$TMS->AddFileSection($template);
if ($total > $onPage && $onPage != 0) {
Common::parse_nav_pages($total, $onPage, $sl, $TPA->page_link . '/~show_album/' . $album["basic"], '', '');
$limit = " LIMIT " . $sl . "," . $onPage;
} else {
$limit = '';
}
$photos = $this->_tree->GetChildsParam($GalleryStart, array('LastModified', 'Name', 'image', 'category', 'info', 'changed', 'img_big'), true, null, 'ASC', $limit);
if ($params['generate_branch']) {
$this->bones_path['gallery_node'] = array('params' => array('Name' => $album['params']['Name'], 'Basic' => $album['params']['Basic']));
}
$preview = $TMS->isSectionDefined('preview');
if ($photos) {
$album["params"]["shown"] = count($photos);
$album["params"]["end"] = $sl + count($photos) + 1;
$TMS->AddMassReplace('album', $album["params"]);
$TMS->AddReplace('album', '_ARES', $_PATH['WEB_PATH_ARES']);
if ($preview) {
$TMS->AddMassReplace('preview', $album["params"]);
}
$params["Width"] ? $width = $params["Width"] : ($width = $album["thumb_width"]);
$i = 0;
foreach ($photos as $photo) {
$tmp = array("_num" => $i, "Name" => $photo["params"]["Name"], "_num_abs" => $i + 1 + (int) $sl, "id" => $photo["id"], "img_src" => $photo["params"]["image"], "width" => $width, "inRow" => $params["Levels"], "info" => $photo["params"]["info"], "album_id" => $album["id"]);
$TMS->AddMassReplace('photo', $tmp);
$TMS->parseSection('photo', true);
if ($preview) {
$TMS->AddMassReplace('preview_photo', $tmp);
$TMS->parseSection('preview_photo', true);
}
$i++;
}
if ($preview) {
$TMS->parseSection('preview', true);
}
$TMS->AddMassReplace('album', $tab);
return $TMS->parseSection('album');
} else {
$TMS->AddMassReplace('album', $album["params"]);
$TMS->AddMassReplace('gallery_empty', $gallery);
return $TMS->parseSection('gallery_empty');
}
}
示例3: show_contents_list
function show_contents_list($params)
{
global $TMS, $TPA, $REQUEST_ASSOC;
$TMS->AddFileSection(Common::get_site_tpl($this->_module_name, $params['xTemplate']));
$startpage = isset($REQUEST_ASSOC['sl']) ? (int) $REQUEST_ASSOC['sl'] : 0;
$count = (int) $params['OnPage'];
Common::call_common_instance('pages');
$pages =& pages_module_common::getInstance();
$content_page = $pages->create_page_path($params['page']) . '/~show_articles/cid/';
$link = $pages->create_page_path($params['page']) . '/~show_article/cid/';
if ($articles_count = $this->_tree->GetChilds($params['Category'], 'ASC', 0, 0, null, true)) {
if (!$count) {
$count = $articles_count;
}
if ($articles_count > 0 && $count > 0) {
if ($articles_count / $count > 1) {
Common::parse_nav_pages($articles_count, $count, $startpage, $content_page . $params['Category']);
$articles = $this->_tree->GetChilds($params['Category'], 'ASC', $startpage, $count);
} else {
$articles = $this->_tree->GetChilds($params['Category']);
}
}
foreach ($articles as $article) {
$fd = $this->_common_obj->get_fields_data($article['id']);
$fd['link'] = $link . $article['id'];
$TMS->AddMassReplace('article', array_merge($fd, $article));
$TMS->parseSection('article', true);
}
}
$Category = $this->_tree->getNodeInfo($params['Category']);
$cat['header'] = $Category['basic'];
$cat['description'] = $Category['params']['description'];
$this->seoConfirm($Category);
$TMS->AddMassReplace('articles_list', $cat);
return $TMS->parseSection('articles_list', true);
}
示例4: render_news
function render_news($news_list, $news_server_page, $cat_info, $news_count, $news_on_page, $startpage = 0)
{
global $TMS, $REQUEST_ASSOC;
//DebugBreak();
// тут правил
isset($REQUEST_ASSOC['s']) ? $s = $REQUEST_ASSOC['s'] : ($s = 0);
isset($REQUEST_ASSOC['e']) ? $e = $REQUEST_ASSOC['e'] : ($e = 0);
if ($news_count > 0 && $news_on_page > 0) {
if ($news_count / $news_on_page > 1) {
if ($s && $e) {
Common::parse_nav_pages($news_count, $news_on_page, $startpage, $news_server_page . '/~newsinterval/id/' . $cat_info['id'] . '/s/' . $s . '/e/' . $e);
} else {
Common::parse_nav_pages($news_count, $news_on_page, $startpage, $news_server_page . '/~showncat/id/' . $cat_info['id']);
}
}
}
// конец правки
$TMS->AddReplace('_news_interval', 'archive_link', $news_server_page);
$last = sizeof($news_list);
$i = 1;
if ($news_list) {
foreach ($news_list as $news) {
$news['link'] = $news_server_page . '/~shownews/' . $news['Basic'];
$news['tags'] = $this->get_tags($news['tags'], $news_server_page);
if ($i == $last) {
$TMS->AddMassReplace('_news_node', array('islast' => 1));
}
$TMS->AddMassReplace('_news_node', $news);
$TMS->parseSection('_news_node', true);
$i++;
}
} else {
$TMS->parseSection('_news_fail', true);
}
$TMS->AddMassReplace('_news_interval', $cat_info);
return $TMS->parseSection('_news_interval');
}
示例5: find
function find($parameters)
{
global $TMS, $TDB, $TPA, $REQUEST_VARS;
if ($REQUEST_VARS[1]) {
$TMS->AddFileSection(Common::get_site_tpl($this->_module_name, $parameters['Template']));
$REQUEST_VARS[1] = substr(strrchr($REQUEST_VARS[1], "="), 1);
$REQUEST_VARS[1] = substr($REQUEST_VARS[1], 0, 64);
if ($words = $query = trim(mysql_real_escape_string(urldecode($REQUEST_VARS[1])))) {
$start = isset($REQUEST_VARS[3]) ? (int) $REQUEST_VARS[3] : 0;
$forms = array();
$words = search_module_front::Words2AllForms($words);
while (list(, $val) = each($words)) {
if ($val) {
foreach ($val as &$item) {
$item = iconv('windows-1251', 'UTF-8', $item);
}
$forms = array_merge($forms, (array) $val);
}
}
if (is_array($forms)) {
$words .= ' ' . implode(' ', $forms);
}
$results = $TDB->get_results('
SELECT SQL_CALC_FOUND_ROWS id, url, title, body
FROM search_pages_index
WHERE MATCH (`title`, `body`, `index`) AGAINST (\'' . $words . '\')
AND status = 200 LIMIT ' . $start . ',' . $parameters['onPage']);
$counter = $TDB->get_results('SELECT FOUND_ROWS()');
$counter = current($counter);
$counter = $counter['FOUND_ROWS()'];
// если не нашлось в индексах - ищем RLIKE'ом
if (!$counter) {
$results = $TDB->get_results('SELECT SQL_CALC_FOUND_ROWS id, url, title, body FROM search_pages_index WHERE body RLIKE ' . "'[[:<:]]{$query}" . "[[:>:]]'" . 'OR title RLIKE ' . "'[[:<:]]{$query}" . "[[:>:]]'" . ' AND STATUS = 200 LIMIT ' . $start . ',' . $parameters['onPage']);
$counter = $TDB->get_results('SELECT FOUND_ROWS()');
$counter = current($counter);
$counter = $counter['FOUND_ROWS()'];
$words = array();
$words[] = $query;
$words[] = $query;
}
if (!$counter) {
$results = $TDB->get_results('SELECT SQL_CALC_FOUND_ROWS id, url, title, body FROM search_pages_index WHERE body LIKE ' . "'%{$query}%'" . ' OR title LIKE ' . "'%{$query}%'" . ' AND STATUS = 200 LIMIT ' . $start . ',' . $parameters['onPage']);
$counter = $TDB->get_results('SELECT FOUND_ROWS()');
$counter = current($counter);
$counter = $counter['FOUND_ROWS()'];
}
if ($results) {
$pages =& pages_module_common::getInstance(true);
if ($page = end($TPA->bones_path)) {
$search_server_page = $pages->create_page_path($page['id'], false, 'find');
}
Common::parse_nav_pages($counter, $parameters['onPage'], $start, $search_server_page . '=' . $REQUEST_VARS[1], 'search_');
$i = $start;
foreach ($results as $result) {
$result['num'] = ++$i;
//$result['body'] = XSTRING::findncut_symbol_positon($result['body'],' ',30).'...';
$result['body'] = $this->extract_sentence($result['body'], $words);
$result['url'] = $result['url'];
$result['title'] = empty($result['title']) ? $result['url'] : $result['title'];
$TMS->AddMassReplace('xtr_search_result', $result);
$TMS->parseSection('xtr_search_result', true);
}
$query = strip_tags(htmlspecialchars($query));
$TMS->AddMassReplace('xtr_search_results', array('query' => $query, 'query_num' => $counter));
return $TMS->parseSection('xtr_search_results');
} else {
$query = strip_tags(htmlspecialchars($query));
$TMS->AddMassReplace('xtr_search_nothing_found', array('query' => $query));
return $TMS->parseSection('xtr_search_nothing_found');
}
} else {
$TMS->AddMassReplace('xtr_search_empty', array('query' => $query));
return $TMS->parseSection('xtr_search_empty');
}
}
}
示例6: catsearch
function catsearch($params)
{
global $TMS, $TPA, $REQUEST_ASSOC;
if ($REQUEST_ASSOC['@onpage']) {
$_SESSION['catalog']['Onpage'] = $REQUEST_ASSOC['@onpage'];
}
$onpage = explode(',', $params['Onpage']);
if (count($onpage) > 1) {
$this->onpage = $onpage;
}
if (!$_SESSION['catalog']['Onpage']) {
$params['Onpage'] = $onpage[0];
} else {
$params['Onpage'] = $_SESSION['catalog']['Onpage'];
}
if ($_POST['search']) {
$spack = $_POST['search'];
} elseif (is_array($params['search'])) {
$spack = $params['search'];
} else {
$spack = $this->request_to_filter();
}
$params['spack'] = $spack;
$params['startpage'] = $startpage = isset($REQUEST_ASSOC['@sl']) ? $REQUEST_ASSOC['@sl'] : 0;
$pages =& pages_module_common::getInstance();
if ($this->ishop) {
$this->BasketPage = $pages->create_page_path($params['BasketPage']);
}
if ($OM = $this->select_objects($params)) {
if (!$params['ignoreTemplate']) {
$TMS->AddFileSection(Common::get_site_tpl($this->_module_name, $params['ResultTemplate']));
}
$this->current_search_filter = $getter_line = $this->filter_to_request($params['spack']);
Common::parse_nav_pages($OM['count'], $params['Onpage'], $startpage, $TPA->page_link . '/~catsearch' . $getter_line, '', '@sl');
$_SESSION['catalog']['search_count'] = $OM['count'];
if ($d = $pages->get_module_by_action($params['Destination_page'], 'show_catalog_server')) {
$ancid = $d['params']['showBasicPointId'];
}
$this->cat_objects_render($OM['objects'], '_catalog_list_item', $ancid, '', $params['Destination'], $params['Render_by_items']);
$TMS->AddMassReplace('_catalog_category_list', array('Link' => $TPA->page_link . '/', 'search_count' => $OM['count'], 'search_filter' => $getter_line));
return $TMS->parseSection('_catalog_category_list');
} else {
if (!$params['ignoreTemplate']) {
$TMS->AddFileSection(Common::get_site_tpl($this->_module_name, $params['ResultTemplate']));
}
return $TMS->parseSection('_catalog_search_failed');
}
}
示例7: show_guestbook
function show_guestbook($params)
{
global $TMS, $TPA, $REQUEST_ASSOC, $TDB;
$sl = isset($REQUEST_ASSOC['sl']) ? (int) $REQUEST_ASSOC['sl'] : 0;
$params["sl"] = $sl;
$node = $this->_tree->getNodeInfo($params["treads"]);
$cobjects = $this->_tree->GetChilds($params["treads"]);
$found = $this->_tree->Search(array('CobjectId' => $TPA->page_node["id"], 'Module' => 'pages'), false);
$cobj = array();
for ($i = 0; $i < count($found); $i++) {
for ($j = 0; $j < count($cobjects); $j++) {
if ($found[$i] == $cobjects[$j]["id"]) {
$cobj[] = $found[$i];
break;
}
}
}
if (is_array($cobj) && count($cobj)) {
$query = 'select count(*) as xcount from comments where Active=1 and cid in (' . implode(',', $cobj) . ');';
if ($r = $TDB->get_results($query)) {
$total = (int) $r[1]["xcount"];
} else {
$total = 0;
}
} else {
$total = 0;
}
$TMS->AddFileSection(Common::get_site_tpl($this->_module_name, $params['Template']));
$TMS->AddMassReplace("_send_comment_form", array("tread_id" => $params["treads"], "tread" => $node["basic"], "node_id" => $TPA->page_node["id"]));
$TMS->AddMassReplace("_guestbook", array("Alias" => $node["params"]["Alias"], "Total" => $total, "Moderation" => $node["params"]["Moderation"], "Captcha" => $node["params"]["Captcha"]));
if ($total) {
$comments = $this->get_last_comments($params);
Common::parse_nav_pages($total, $params["count"], $sl, $TPA->page_link . '/~guestbook');
foreach ($comments as $comment) {
$TMS->AddMassReplace('_comment', $comment);
$TMS->parseSection('_comment', true);
}
} else {
$TMS->parseSection('_empty', true);
}
$TMS->parseSection('_send_comment_form', true);
return $TMS->parseSection('_guestbook');
}