<?php  
 //Global $andlangbh;    
			 $sql2 = "SELECT * from ".TABLE_REGION." where pidname='$regionpidname'    $andlangbh order by id";
			 if(getnum($sql2)>0){
				$row2 = getrow($sql2);
			   // pre($row2);
				$cssnamepar = $row2['cssname'];
				$regioneffect = $row2['effect'];$haswow = $row2['haswow'];
				$addcss_reg2 = $row2['addcss'];
				$addjs_reg2 = $row2['addjs'];
				if($addcss_reg2<>'') getcssjs($addcss_reg2,$dmregdir2);
				if($addjs_reg2<>'') getcssjs($addjs_reg2,$dmregdir2);
				 echo '<div class="regionwrap '.$cssnamepar.'" data-effect="'.$regioneffect.'">'; 				
					  //---------------------
					    $sqlsubreg = "SELECT * from ".TABLE_REGION." where pid='$regionpidname'  and sta_visible='y'  $andlangbh order by pos desc,id";
							 //echo $sqlbuju;
						 
							 if(getnum($sqlsubreg)>0){  
							      $result_subreg = getall($sqlsubreg);
									  if(substr($regioneffect,0,5)=='self_')  $file =  TPLCURROOT.'selfblock/region/'.$regioneffect;                   
									  else  $file =  BLOCKROOT.'region/'.$regioneffect; 
									  if(checkfile($file))    require $file;    
								}
								else { 
								   echo  '<p class="errorfont">出错，没有找到这个区域下的子记录。-- '.$region.'，或者是它的子记录都隐藏了。(至少要有一个是显示的) (注意前后台语言是否一致。)</p>';
								}
					//----------------------------					  
				
				echo '</div>';			
				}					 
			 else{ 
					echo  '<p class="errorfont">出错，没有这个区域： '.$pidname.' (注意前后台语言是否一致。)</p>';
			 }	
			 
 

		
		?>


<?php

function subreg_echocnt($v,$haswow){
   
$titlefg = 'titlecenter';
$blockid = $linktitle= $linkurl = '';

$arr_cfg=$v['arr_cfg'];  $format = $v['format'];
 
$bscntarr = explode('==#==',$arr_cfg);
     if(count($bscntarr)>1){
          foreach ($bscntarr as   $bsvalue) {
             if(strpos($bsvalue, ':##')){
               $bsvaluearr = explode(':##',$bsvalue);
               $bsccc = $bsvaluearr[0];
               $$bsccc=$bsvaluearr[1];
             }
          }
      }
 
$title=$v['name'];$pidnamehere=$v['pidname']; 
 $kv= $v['kv'];  
  
 $imgv ='';
 if($kv<>'')   $imgv = '<div class="img tc"><img class="maximg" src="'.get_img($kv).'" alt="'.$title.'" /></div>';
  
 
$despjj=web_despdecode($v['despjj']);
 $desptext= web_despdecode($v['desptext']);
$desp= web_despdecode($v['desp']);
$despv = $desptext<>''?$desptext:$desp;

  if($linktitle=='') $linkregionv = '';
 else $linkregionv = '<div class="dmbtn mt10"><a class="more" '.linkhref($linkurl).'>'.$linktitle.'</a></div>'; 
$despv = $despv.$linkregionv;
 
//------------------------
  if($titleimg<>'')   $titleimgv = '<img src="'.UPLOADPATHIMAGE.$titleimg.'" alt="" />';
   else   $titleimgv = $title;

   $titlev = '<h3>'.$title.'</h3>';
     if(is_int(strpos($cssname,'hasnotitle'))) $titlev = '';

//--------------------
$titlestylev = $titlestyle<>''?' style="'.$titlestyle.'"':'';
$titlestylesubv = $titlestylesub<>''?' style="'.$titlestylesub.'"':'';

$titlelinelongv = $titlelineshortv = '';
 if($titlelinelong<>''){
     if($titlelinelong=='hide') $titlelinelongv =  ' style="border:0;height:0"';
     else $titlelinelongv =  ' style="border-bottom:1px solid '.$titlelinelong.'"';
 }
 if($titlelineshort<>''){
     if($titlelineshort=='hide') $titlelineshortv =  ' style="display:none"';
     else $titlelineshortv =  ' style=" background:'.$titlelineshort.'"';
 }

 
 $sta_width_titlev = $sta_width_title=='n'?' container ':''; 
 $sta_width_cntv = $sta_width_cnt=='n'?' container ':''; 

//begion title header
//echo $titlefg;
   if($titlefg<>'notitle'){
        $regionhdleftv =  $titlefg=='titleleft'?' regionhdleft ':'';
       
            echo '<div class="regionhd '.$regionhdleftv.$sta_width_titlev.'"><h3 class="hd" '.$titlestylev.'>'.$title.'</h3>';
            echo '<div class="titleline  titlelinelong " '.$titlelinelongv.'> <span class="titlelineshort" '.$titlelineshortv.'></span></div>';
            if($despjj<>'') echo '<div class="regsubtitle" '.$titlestylesubv.'>'.$despjj.'</div>'; 
            echo '</div>';
   }

 //end title header

//begin content
   if($format=='textleft' || $format=='textright')  {  $colw_L = 'colhalf ';$colw_R = 'colhalf '; }
   if($format=='textleft13')  {  $colw_L = 'col_1f3 ';$colw_R = 'col_2f3 '; }
   if($format=='textleft25')  {  $colw_L = 'col_2f5 ';$colw_R = 'col_3f5 '; }
     
   if($format=='textright13')  {  $colw_L = 'col_2f3 ';$colw_R = 'col_1f3 '; }
   if($format=='textright25')  {  $colw_L = 'col_3f5 ';$colw_R = 'col_2f5 '; }

 echo '<div class="regioncnt '.$sta_width_cntv.'">';
if($haswow=='y') {
      $wowleft = ' wow fadeInLeft';
      $wowright = ' wow fadeInRight';
   }else{
         $wowleft =  $wowright  = '';
   }

      if($format=='default') {   
       echo $imgv;
       if($blockid<>'') block($blockid);
       echo '<div class="desp">';
        dmblockid($despv);
        echo '</div>';       
  }
   
 else if($format=='textleft' || $format=='textleft13' || $format=='textleft25') {    
     echo '<div class="'.$colw_L.$wowleft.'"> '.$titlev.'<div class="desp">'; 
        dmblockid($despv);
        echo '</div></div>'; 
       echo '<div class="'.$colw_R.$wowright.'">'.$imgv;
       if($blockid<>'') block($blockid);
       echo '</div>';
       echo '<div class="c"> </div>';        
        
  }
 else  if($format=='textright' || $format=='textright13' || $format=='textright25') {  
       echo '<div class="'.$colw_L.$wowleft.'">'.$imgv;
       if($blockid<>'') block($blockid);
       echo '</div>';

       echo '<div class="'.$colw_R.$wowright.'">'.$titlev.'<div class="desp">'; 
        dmblockid($despv);
        echo '</div></div>'; 
       echo '<div class="c"> </div>';
        
  }   

   else  if($format=='onlyedit') {          
         echo ' <div class="desp">';
         dmblockid($despv);
        echo '</div>';
      // echo $despv;
        
  }  

   
 else if($format=='onlybs') {  
       block($blockid);
       echo $linkregionv; 
  }  
   else if($format=='column') {   ;
         columnecho($pidnamehere);
        
  } 
echo '</div>'; 
// end content

//-------------------------------------  
}
  
 

?>