<?php 
if(!defined('IN_DEMOSOSO')) {
    exit('this is wrong page,please back to homepage');
}

  
 //----------------
$pidname = $pidcate;
 $result = getarr_cate($pidname);
 //pre($result);

 if($result['datares']=='yes'){
 $data = $result['data'];

 ?>
 
      <div class="diviso_filter">

        <a href="#"  data-filter="*"  class="active">所有</a>
          <?php 
                                foreach($data as $v){
                                $name = decode($v['name']); $pidnamecate = $v['pidname'];
                                ?>
            <a href="#" data-filter=".<?php echo $pidnamecate?>" class=""><?php echo $name?></a>
                <?php
                       
                    }
              ?>




      </div>


     <div class="grid2ceng isotope  gridlistiso c">
         <ul>
  <?php 
             // $pidname = 'cate20150805_1125344029';
               
              $sqlarr = array( 
                'excerpt'=>120,
                'start'=>0,
                'maxline'=>20,
               'order'=>'','where'=>'',
                );
              $resultnode = getarr_node($pidname,$sqlarr);
              $datanode = $resultnode['data'];

                foreach ($datanode as $k => $v) {
                //  pre($v);
                    $title =  $v['title']; 
                    $kvsm= get_kvsm_cus($v['kvsm_cus'],$v['kvsm']);         
        $img = get_img($kvsm);  

                    $link = $v['link'] ;

                    //--get filter 
                    $pid=$v['pid'];

                    if(substr($pidname,0,4)=='csub') {//then pidcate is not main cate
                         $filter = $pid;
         
                    }
                    else{  
                         $parpid   =  get_field(TABLE_CATE,'pid',$pid,'pidname');
                         if(substr($parpid,0,4)=='cate') $filter = $pid;
                         else {
                             $parpid   =  get_field(TABLE_CATE,'pid',$pid,'pidname');
                             $filter = $parpid;
                         }
                      
                    }

                 
             ?>   

  <li class="<?php echo $filter;?> isotope-item  boxcol gcoverlayjia  <?php echo $cus_columnsv;?>">
     <a   <?php echo linkhref($link)?>">
         <div class="overlay"><span>+</span></div>
           <div class="img">
              <img src="<?php echo $img?>" alt="<?php echo $title?>">
            </div>
           <h4><?php echo $title?></h4>
    </a>
</li>




<?php
  }

?>

   </ul>

  </div>
  <?php
if($linktitle<>'' && $linkurl<>'')  echo  '<div class="dmbtn mt10 tc"><a class="more" '.linkhref($linkurl).'>'.$linktitle.'</a></div>';
  ?>


<?php
getcssjs('assets/vendor/singlejs/isotope.pkgd.min.js');
?>

    <script>
$(function(){


			//--------ISOTOPE----------
			var diviso_items = $('.gridlistiso');
			// initialize isotope
			diviso_items.isotope({
			  itemSelector : '.isotope-item',
			  layoutMode : 'fitRows'
			});

			// filter items when filter link is clicked
			$('.diviso_filter a').click(function(){
			  $('.diviso_filter a').removeClass('active');
			  $(this).addClass('active');
			  var selector = $(this).attr('data-filter');
			  diviso_items.isotope({ filter: selector });
			  return false;
			});
			//--------END ISOTOPE----------


		//---------end load------------
        });
   </script>
<?php
}
else {
  echo $result['dataerror'];
}
?>