当前位置: 首页>>代码示例>>PHP>>正文


PHP Link::Category方法代码示例

本文整理汇总了PHP中Link::Category方法的典型用法代码示例。如果您正苦于以下问题:PHP Link::Category方法的具体用法?PHP Link::Category怎么用?PHP Link::Category使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Link的用法示例。


在下文中一共展示了Link::Category方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ShowPages

 /**
  * возвращает макет пагинации
  */
 function ShowPages()
 {
     $tpl =& $GLOBALS['tpl'];
     // урл текущей страницы без page_id=N
     $res = explode("?", preg_replace('/\\/p[0-9]+/', '', $_SERVER['REQUEST_URI']));
     $base_url = preg_replace('/\\/$/', '', $res[0]);
     $get_string = isset($res[1]) ? $res[1] : null;
     $template = array();
     $pages = array();
     foreach ($this->pages as $key => $page) {
         // Если числовые страницы
         // if(is_numeric($key)){
         if ($this->active_page == $page) {
             $pages['main'][] = '<li class="page' . $page . ' active"><a href="#">' . $page . '</a></li>';
         } else {
             if (strstr($base_url, '/adm')) {
                 $url = $base_url . '/p' . $page;
             } else {
                 if ($GLOBALS['CurrentController'] == 'products') {
                     $url = Link::Category($GLOBALS['Rewrite'], array('page' => $page));
                 } else {
                     $url = $base_url . '/p' . $page;
                 }
             }
             $url .= isset($get_string) && !isset($_GET['search_subcategory']) ? '?' . $get_string : null;
             if (is_numeric($key)) {
                 $pages['main'][] = '<li class="page' . $page . '"><a href="' . $url . '" class="animate">' . $page . '</a></li>';
             } else {
                 if (in_array($key, array('prev', 'next'))) {
                     $page = '<i class="material-icons">more_horiz</i>';
                     if (strstr($base_url, '/adm')) {
                         $page = '...';
                     }
                 }
                 $pages[$key] = '<li class="' . $key . '"><a href="' . $url . '" class="animate">' . $page . '</a></li>';
             }
         }
     }
     $tpl->Assign('last_page', $this->pages_count);
     $tpl->Assign('pages', $pages);
     $parsed_content = $tpl->Parse($GLOBALS['PATH_tpl_global'] . 'paginator.tpl');
     // print_r(Link::Category($GLOBALS['Rewrite']));
     if (isset($GLOBALS['Rewrite'])) {
         if ($GLOBALS['CurrentController'] == 'products') {
             $page_base = Link::Category($GLOBALS['Rewrite'], array('page' => 1));
         } else {
             $page_base = Link::Custom($GLOBALS['CurrentController'], $GLOBALS['Rewrite']);
         }
         $GLOBALS['meta_canonical'] = Link::Category($GLOBALS['Rewrite']);
         if ($this->pages_count > 1) {
             $prev = Link::Category($GLOBALS['Rewrite'], array('page' => $this->active_page - 1));
             $next = Link::Category($GLOBALS['Rewrite'], array('page' => $this->active_page + 1));
             // $GLOBALS['meta_canonical'] = $page_base;
             if ($this->active_page == 1) {
                 $GLOBALS['meta_next'] = $next;
                 // $GLOBALS['meta_canonical'] = $page_base;
             } elseif ($this->active_page == $this->pages_count) {
                 $GLOBALS['meta_prev'] = $prev;
             } else {
                 $GLOBALS['meta_prev'] = $prev;
                 $GLOBALS['meta_next'] = $next;
             }
         }
     }
     // var_dump($GLOBALS['meta_canonical']);
     // print_r('<br>');
     // var_dump($GLOBALS['meta_next']);
     // print_r('<br>');
     // var_dump($GLOBALS['meta_prev']);
     // print_r('<br>');
     return $parsed_content;
 }
开发者ID:Arikito,项目名称:webking.xt,代码行数:75,代码来源:paginator_c.php

示例2: generateNavigation

    /**
     * [generateNavigation description]
     * @param  [type]  $list [description]
     * @param  integer $lvl  [description]
     * @return [type]        [description]
     */
    public function generateNavigation($list, $lvl = 0, $no_rel = false)
    {
        if (isset($GLOBALS['CURRENT_ID_CATEGORY'])) {
            $id_cat = $GLOBALS['CURRENT_ID_CATEGORY'];
        }
        $lvl++;
        $arr['clear'] = 'true';
        if (isset($_POST['idsegment'])) {
            $arr['segment'] = $_POST['idsegment'];
        }
        $ul = '<ul ' . ($lvl == 1 ? 'class="second_nav allSections" ' : '') . 'data-lvl="' . $lvl . '">';
        foreach ($list as $l) {
            $ul .= '<li' . (isset($GLOBALS['current_categories']) && in_array($l['id_category'], $GLOBALS['current_categories']) ? ' class="active"' : '') . '><span class="link_wrapp">
			<a ' . ($no_rel || !isset($GLOBALS['current_categories']) && $GLOBALS['CurrentController'] != 'product' ? '' : 'rel="nofollow"') . ' href="' . Link::Category($l['translit'], $arr) . '">' . $l['name'] . '</a>';
            if (!empty($l['subcats']) && !isset($_GET['debug'])) {
                /*if($l['pid'] != 0 && $l['category_level'] != 1) {
                			$ul .= '<span class="more_cat"><i class="material-icons rotate">&#xE315;</i></span></span>';
                		}else{
                			$ul .= '<span class="more_cat"><i class="material-icons">&#xE315;</i></span></span>';
                		}*/
                $ul .= '<span class="more_cat"><i class="material-icons">add</i></span></span>';
                $ul .= $this->generateNavigation($l['subcats'], $lvl, isset($id_cat) && $id_cat == $l['id_category'] || $no_rel ? true : null);
                $ul .= '</li>';
            } else {
                $ul .= '</span></li>';
            }
        }
        $ul .= '</ul>';
        return $ul;
    }
开发者ID:Arikito,项目名称:webking.xt,代码行数:36,代码来源:products_c.php

示例3: Products

<?php

if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
    $Products = new Products();
    if (isset($_POST['action'])) {
        switch ($_POST['action']) {
            case "getFilterLink":
                echo json_encode(Link::Category($_POST['rewrite'], $_POST['params'], $_POST['segment']));
                break;
            case "getmoreproducts":
                $id_category = isset($_POST['id_category']) ? $_POST['id_category'] : null;
                $dbtree = new dbtree(_DB_PREFIX_ . 'category', 'category', $db);
                function selectAll($dbtree, $id_category = null, $str = array())
                {
                    $subcats = $dbtree->GetSubCats($id_category, array('id_category', 'category_level', 'category_img', 'name', 'translit', 'art', 'pid', 'visible'));
                    if ($id_category != 0) {
                        $str[] = $id_category;
                    }
                    if (!empty($subcats)) {
                        foreach ($subcats as $val) {
                            $str = selectAll($dbtree, $val["id_category"], $str);
                        }
                    }
                    return $str;
                }
                $where_arr['cp.id_category'] = $id_category;
                if (!_acl::isAdmin()) {
                    $where_arr['p.visible'] = 1;
                }
                $params = array('group_by' => 'a.id_product', 'ajax' => true, 'rel_search' => null);
                if (isset($_COOKIE['sorting'])) {
开发者ID:Arikito,项目名称:webking.xt,代码行数:31,代码来源:products.php

示例4: switch

<?
if(isset($_POST['action'])){
    switch($_POST['action']) {
        case "GetUrlWithPrice":
            $link = Link::Category( $GLOBALS['Rewrite'], array('price_range' => $_POST['price']));
            echo $link;
            break;
    }
}
exit();
?>
开发者ID:Arikito,项目名称:webking.xt,代码行数:11,代码来源:link.php

示例5: array_shift

            $GLOBALS['CurrentController'] = 'products';
            $GLOBALS['Rewrite'] = array_shift($rewrite_arr);
        } else {
            $GLOBALS['CurrentController'] = array_shift($rewrite_arr);
            $GLOBALS['Rewrite'] = array_shift($rewrite_arr);
            $GLOBALS['Rewrite'] = $GLOBALS['Rewrite'] == $GLOBALS['CurrentController'] ? false : $GLOBALS['Rewrite'];
        }
        // парсим строку с примененными фильтрами
        $GLOBALS['Filters'] = G::ParseUrlParams(array_pop($rewrite_arr));
    }
}
if (isset($_REQUEST['paginator_specific_page'])) {
    $rewrite_arr['page'] = $_REQUEST['paginator_specific_page'];
    header("HTTP/1.1 301 Moved Permanently");
    if ($GLOBALS['CurrentController'] == 'products') {
        header("Location: " . Link::Category($GLOBALS['Rewrite'], $rewrite_arr));
    } else {
        header("Location: " . Link::Custom($GLOBALS['CurrentController'], $GLOBALS['Rewrite'], $rewrite_arr));
    }
    exit;
}
if (isset($rewrite_arr) && count($rewrite_arr) > 0) {
    switch ($GLOBALS['CurrentController']) {
        case 'product':
            header("HTTP/1.1 301 Moved Permanently");
            header("Location: http://" . $_SERVER['SERVER_NAME'] . '/' . str_replace(implode('/', $rewrite_arr) . '/', '', $request_url));
            break;
        default:
            header("HTTP/1.1 301 Moved Permanently");
            header("Location: http://" . $_SERVER['SERVER_NAME'] . '/' . str_replace(implode('/', $rewrite_arr) . '/', '', $request_url) . '/');
            break;
开发者ID:Arikito,项目名称:webking.xt,代码行数:31,代码来源:routes.php

示例6: explode

}
if (isset($_SERVER['HTTP_REFERER'])) {
    $referer = explode('/', str_replace('http://', '', $_SERVER['HTTP_REFERER']));
    $tpl->Assign('referer', $referer);
}
if ((!isset($referer[2]) || $referer[2] != $id_category) && !isset($_GET['query'])) {
    unset($_SESSION['filters']);
    //unset($_SESSION['search']);
}
if (isset($_POST['dropfilters'])) {
    unset($_SESSION['filters']);
}
$res = $dbtree->Parents($id_category, array('id_category', 'name', 'translit', 'category_level', 'indexation'));
foreach ($res as $cat) {
    if ($cat['id_category'] != $id_category) {
        $GLOBALS['IERA_LINKS'][] = array('title' => $cat['name'], 'url' => Link::Category($cat['translit'], array('clear' => true)));
    }
    $end = end($GLOBALS['IERA_LINKS']);
    $GLOBALS['products_canonical'] = $end['url'];
}
function selectAll($dbtree, $id_category = null, $str = array())
{
    $subcats = $dbtree->GetSubCats($id_category, array('id_category', 'category_level', 'name', 'translit', 'pid', 'visible'));
    if ($id_category != 0) {
        $str[] = $id_category;
    }
    if (!empty($subcats)) {
        foreach ($subcats as $val) {
            $str = selectAll($dbtree, $val["id_category"], $str);
        }
    }
开发者ID:Arikito,项目名称:webking.xt,代码行数:31,代码来源:products.php


注:本文中的Link::Category方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。