Exemplo n.º 1
0
function hits2art($cat_id = 0, $num = 10, $is_all = 1, $order = '')
{
    $top_cat_id = top_parent($cat_id);
    $top_cat = CMS_M('category')->where('category_id=' . $top_cat_id)->find();
    $table = CMS_M('cm_table')->where('table_id=' . $top_cat['module_id'])->find();
    $table_name = $table['table_name'];
    $table_m = CMS_M($table_name);
    $table_m_pk = $table_m->getPk();
    $resultAllCat = array();
    $articles = array();
    $originCat = CMS_M('category')->where('category_id=' . $cat_id)->find();
    $resultAllCat[] = $originCat;
    if ($is_all == 1) {
        get_child_cat($cat_id, $resultAllCat);
    }
    $ids = array();
    $where = array();
    foreach ($resultAllCat as $row) {
        $ids[] = $row['category_id'];
    }
    $where['cat_id'] = array('in', $ids);
    $order = $order == '' ? 'hits DESC,' . $table_name . '_sort ASC' : $order;
    import('ORG.Util.Page');
    $count = $table_m->where($where)->order($order)->count();
    $Page = new Page($count, $num);
    $show = $Page->show();
    $list = $table_m->where($where)->order($order)->limit($Page->firstRow . ',' . $Page->listRows)->select();
    foreach ($list as $key => $val) {
        $where2 = array();
        $where2['category_id'] = $val['cat_id'];
        $catInfo = CMS_M('category')->where($where2)->find();
        $list[$key]['cat_info'] = $catInfo;
    }
    $articles = array();
    $articles['lists'] = $list;
    $articles['page'] = $show;
    return $list;
}
Exemplo n.º 2
0
 
          <?php 
}
?>
 
        </div>
      </div>
      <div class="content mid_floor">
        <div class="goods">
          <div class="middle-layout">
            <ul class="tabs-nav">
              <li class="tabs-selected">
                <h3>精挑细选</h3>
              </li>
              <?php 
$GLOBALS['smarty']->assign('child_cat', get_child_cat($GLOBALS['smarty']->_var['goods_cat']['id'], 3));
?>
              <?php 
$_from = $this->_var['child_cat'];
if (!is_array($_from) && !is_object($_from)) {
    settype($_from, 'array');
}
$this->push_vars('', 'cat_item');
$this->_foreach['child_cat'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['child_cat']['total'] > 0) {
    foreach ($_from as $this->_var['cat_item']) {
        $this->_foreach['child_cat']['iteration']++;
        ?>

              <li class="">
                <h3><?php 
Exemplo n.º 3
0
  </div>
  <div class="blank"></div>
  <div class="blank"></div>
  <div class="w"> <?php 
echo $this->fetch('library/goods_best.lbi');
?>
    <div class="left">
      <div id="related-sorts" class="m m2">
        <div class="mt">
          <h2>相关分类</h2>
        </div>
        <div class="mc">
          <ul class="lh">
            <?php 
$parent_cat_id = get_parent_cat_id($GLOBALS['smarty']->_var['goods']['cat_id']);
$GLOBALS['smarty']->assign('child_cat', get_child_cat($parent_cat_id));
?>
            <?php 
$_from = $this->_var['child_cat'];
if (!is_array($_from) && !is_object($_from)) {
    settype($_from, 'array');
}
$this->push_vars('', 'cat');
$this->_foreach['child_cat'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['child_cat']['total'] > 0) {
    foreach ($_from as $this->_var['cat']) {
        $this->_foreach['child_cat']['iteration']++;
        ?>
            <li><a href="<?php 
        echo $this->_var['cat']['url'];
        ?>
Exemplo n.º 4
0
<div class="w mt20 floor1 floor2 cat_floor">
  <div class="header clearfix">
    <div class="Left"><a class="title" href="category.php?id=<?php 
echo $this->_var['goods_cat']['id'];
?>
" target="_blank"></a></div>
    <div class="Right"><span class="words"><?php 
$_from = get_child_cat($GLOBALS[smarty]->_var[goods_cat][id]);
if (!is_array($_from) && !is_object($_from)) {
    settype($_from, 'array');
}
$this->push_vars('', 'cat_item');
$this->_foreach['child_cat'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['child_cat']['total'] > 0) {
    foreach ($_from as $this->_var['cat_item']) {
        $this->_foreach['child_cat']['iteration']++;
        if ($this->_foreach['child_cat']['iteration'] < 9) {
            ?>
&emsp;<a href="<?php 
            echo $this->_var['cat_item']['url'];
            ?>
" target="_blank"><?php 
            echo htmlspecialchars($this->_var['cat_item']['name']);
            ?>
</a>&emsp;<span style="color:#ddd">|</span><?php 
        }
    }
}
unset($_from);
$this->pop_vars();
?>