<?php
$filedir3 = HEADERROOT.$sysblockfolder;
if(is_dir($filedir3)){
   $filearr = dmgetDir($filedir3);
  }
//pre($filearr);

   //------merge template selfblock file

$filedir = TPLCURROOT.'selfblock/header/'.$sysblockfolder;
if(is_dir($filedir)){
  $filearr2 = getFile($filedir);
  $filearr = array_merge($filearr2,$filearr);

}

//pre($filearr);
 //------------
 echo  '<select name="'.$selectname.'">';
 if($sysblockfolder=='mobi') echo '<option value="usepc">使用pc端选择</option>';

  // $selectjcgg = $template == 'jcgg'?' selected= "selected" ':'';
  // if($typepagetemplate<>'common')  echo ' <option '.$selectjcgg.'  value="jcgg">继承公共布局的选择</option>';



  foreach ($filearr as $v){
           if($template==$v) $select=' selected '; else $select='';
           $lastname = substr($v,-4);
           if($v=='images')  {    }
            else  echo '<option '.$select.'value="'.$v.'">'.$v.'</option>' ;

    }


//  select_from_arr2($filearr,$template,'');
 //echo '<option value="hide">隐藏hide</option>';
 echo '</select>';

//if($sysblockfolder=='catelist' || $sysblockfolder=='catedetail' )  echo '<p class="cgray">提示：如果布局里有值，则布局里的优先。</p>';

if($template<>''){
    $file = '';

 if(substr($template,0,5)=='self_') {
    $file = TPLCURROOT.'selfblock/header/'.$sysblockfolder.'/'.$template;
    $fileposi = 'DMYI-template/'.HTMLDIR.'/selfblock/header/'.$sysblockfolder.'/';
  }
 else {
        $file = HEADERROOT.$sysblockfolder.'/'.$template.'/'.$template.'.php';
        $fileposi = 'DM-block/header/'.$sysblockfolder.'/'.$template;
    }

    $arrexcept2 =array("jcgg","usepc");
    if (!in_array($template, $arrexcept2)) {
      checkfile($file) ;
      echo '<p class="cgray">文件位于：'.$fileposi.'</p>';
    }


}
 