function smarty_block_mtparentcategories($args, $content, &$ctx, &$repeat)
{
    $localvars = array('_categories', 'category', '_categories_counter', 'glue', '__out');
    if (!isset($content)) {
        $ctx->localize($localvars);
        require_once "MTUtil.php";
        $class = isset($args) && isset($args['class']) ? $args['class'] : 'category';
        $cat = get_category_context($ctx, $class);
        $parents = array();
        get_parent_categories($cat, $ctx, $parents, $class);
        if (!isset($args['exclude_current'])) {
            $parents[] = $cat;
        }
        if (isset($args['glue'])) {
            $glue = $args['glue'];
        } else {
            $glue = '';
        }
        $ctx->stash('_categories', $parents);
        $ctx->stash('glue', $glue);
        $ctx->stash('__out', false);
        $counter = 0;
    } else {
        $parents = $ctx->stash('_categories');
        $counter = $ctx->stash('_categories_counter');
        $glue = $ctx->stash('glue');
        $out = $ctx->stash('__out');
    }
    if ($counter < count($parents)) {
        $ctx->stash('category', $parents[$counter]);
        $ctx->stash('_categories_counter', $counter + 1);
        $repeat = true;
        if (!empty($glue) && !empty($content)) {
            if ($out) {
                $content = $glue . $content;
            } else {
                $ctx->stash('__out', true);
            }
        }
    } else {
        if (!empty($glue) && $out && !empty($content)) {
            $content = $glue . $content;
        }
        $repeat = false;
        $glue = '';
        $ctx->restore($localvars);
    }
    return $content;
}
function smarty_block_mttoplevelparent($args, $content, &$ctx, &$repeat)
{
    if (!isset($content)) {
        $ctx->localize(array('category', 'conditional', 'else_content'));
        require_once "MTUtil.php";
        $cat = get_category_context($ctx);
        require_once "block.mtparentcategories.php";
        $list = array();
        get_parent_categories($cat, $ctx, $list);
        $ctx->stash('else_content', null);
        if (count($list) > 0) {
            $cat = array_pop($list);
            $ctx->stash('category', $cat);
        }
        $ctx->stash('conditional', $cat ? 1 : 0);
    } else {
        if (!$ctx->stash('conditional')) {
            $content = $ctx->stash('else_content');
        }
        $ctx->restore(array('category', 'conditional', 'else_content'));
    }
    return $content;
}
Exemple #3
0
		<div class="search_btn">
                    <input type="image" src="<?php 
echo base_url('assets/images/search_btn.jpg');
?>
" />
			 
		</div><!--search_btn-->
                </form>
	</div><!--search-->
</div><!--header_right-->
<div class="clear"></div><!--clear-->
<nav>
	<div class="nav">
		<ul>
                    <?php 
$categories = get_parent_categories();
$i = 0;
foreach ($categories as $cat) {
    ?>
                    <li <?php 
    echo $i == 0 ? 'style="border-left: 2px solid #fff;"' : '';
    ?>
>
                            <?php 
    $cat_id = $cat['cat_id'];
    ?>
                            <a href="<?php 
    echo base_url('category/?cat_id=' . $cat_id . '&per_page=');
    ?>
" class="cat" rel="<?php 
    echo $cat['cat_id'];
Exemple #4
0
function other_choice_category()
{
    $categories = get_parent_categories();
    $cat_html = '<ul class="treeMenu">';
    foreach ($categories as $category) {
        $child_cts = get_child_cat_dll($category['cat_id']);
        $class = $child_cts != '' ? 'class="closed"' : '';
        $cat_html .= '<li>
							<span ' . $class . '></span>
							<a href="' . base_url("category?cat_id=" . $category['cat_id']) . '&per_page=">' . $category['cat_name'] . '</a>
							' . get_child_cat_dll($category['cat_id']) . '
							<br clear="all" />
						</li>';
    }
    $cat_html .= '</ul>';
    return $cat_html;
}
 function build_CatTree()
 {
     $categories_query = SELECT . CAT_ID . SQL_FROM . TABLE_CATEGORIES;
     $cat_select = olc_db_query($categories_query);
     if (olc_db_num_rows($cat_select)) {
         $this->CatTreeId = array(ZERO_STRING => 0);
         while ($current_cat = olc_db_fetch_array($cat_select)) {
             $cat_id = $current_cat[CAT_ID];
             $categories_names = array();
             get_parent_categories($categories_names, $cat_id);
             $catTree = EMPTY_STRING;
             for ($i = count($categories_names) - 1; $i >= 0; $i--) {
                 $cat_name = addslashes(stripslashes($categories_names[$i]));
                 if ($catTree) {
                     $catTree .= TILDE;
                 }
                 $catTree .= $cat_name;
             }
             $this->CatTreeId[$catTree] = $cat_id;
         }
     }
 }
function product_path($products_id)
{
    $cPath = '';
    $category_query = "select p2c.categories_id\n                       from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n                       where p.products_id = '" . (int) $products_id . "'\n                       and p.products_status = '1'\n                       and p.products_id = p2c.products_id limit 1";
    $category = mysql_query($category_query);
    if (mysql_num_rows($category) > 0) {
        $category = mysql_fetch_array($category, MYSQL_ASSOC);
        $categories = array();
        get_parent_categories($categories, $category['categories_id']);
        $categories = array_reverse($categories);
        $cPath = implode('_', $categories);
        if (not_null($cPath)) {
            $cPath .= '_';
        }
        $cPath .= $category['categories_id'];
    }
    return $cPath;
}
Exemple #7
0
switch ($action) {
    case "get_article":
        echo get_html_article($_REQUEST['aid'], $_REQUEST['cid'], $_REQUEST['uid']);
        break;
    case "all_articles":
        echo get_all_html_articles($_REQUEST['cid'], $_REQUEST['page'] - 1, $_REQUEST['limit']);
        break;
    case "articles_by_section":
        echo get_html_articles_by_section($_REQUEST['section'], $_REQUEST['cid'], $_REQUEST['page'] - 1, $_REQUEST['limit']);
        break;
    case "get_categories":
        //xxxxxxxxxxxxx not use
        echo get_categories($_REQUEST['client_id']);
        break;
    case "get_parent_categories":
        echo get_parent_categories($_REQUEST['client_id']);
        break;
    case "get_categories_by_parent":
        echo get_categories_by_parent($_REQUEST['client_id'], $_REQUEST['parent'], $_REQUEST['udid']);
        break;
    case "get_source_followers":
        echo get_source_followers($_REQUEST['client_id'], $_REQUEST['parent']);
        break;
    case "get_source_followers_by_source_id":
        echo get_source_followers_by_source_id($_REQUEST['client_id'], $_REQUEST['source_ids']);
        break;
    case "get_articles_by_cat":
        //news by my selected sources
        echo get_html_articles_by_cat($_REQUEST['cid'], $_REQUEST['client_id'], $_REQUEST['page'] - 1, $_REQUEST['limit']);
        break;
    case "update_device_id":