<?php
$filedir3 = SYSBLOCKROOT.$sysblockfolder;
if(is_dir($filedir3)){
   $filearr = getFile($filedir3);
  }

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

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

}

//pre($filearr);
 //------------
 $arrexcept =array("headerpc","headermob","banner");

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

    if($selectname=='layoutcatelist' || $selectname=='layoutcatedetail' ) echo '<option value="">不选择。使用分类里的选择。</option>';

    if (in_array($sysblockfolder, $arrexcept)) {
      $selectjcgg = $template == 'jcgg'?' selected= "selected" ':'';
      if($typepagetemplate<>'common')  echo ' <option '.$selectjcgg.'  value="jcgg">继承公共布局的选择</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/'.$sysblockfolder.'/'.$template;
    $fileposi = 'DM-template/'.HTMLDIR.'/selfblock/'.$sysblockfolder.'/';
  }
 else {
        $file = SYSBLOCKROOT.$sysblockfolder.'/'.$template;
        $fileposi = 'DM-block/sysblock/'.$sysblockfolder.'/';
    }

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


}
 
