function selector() { $arr3 = Registor::getLayoutPages(); ksort($arr3); // pr($arr3); ?> <h1><?php echo Lang::t('Layout'); ?> </h1> <div class="table-responsive"> <table class="table table-bordered "> <?php $actual = ""; foreach ($arr3 as $segment => $arr) { if ($actual != $segment) { $actual = $segment; ?> <tr style="font-weight: bold;"> <td colspan="2" style="cursor: pointer;background-color: #efefef;" onclick="$('.hh_<?php echo $actual; ?> ').toggle();"><?php echo $segment; ?> </td> </tr> <?php } foreach ($arr as $mode => $arr2) { //if($mode!="Blog")continue; ?> <tr class="hh_<?php echo $actual; ?> " style="display: none; "> <td><?php echo $mode; ?> </td> <td> <?php //$dire = _THEMEPATH."/Mold/Pages/".$arr2[0]."_".$arr2[1]."/"; $dire = _THEMEPATH . "/Mold/Pages/" . $mode . "/"; // echo $dire."<br>"; if (file_exists($dire)) { $l = new Layout(); $l->getByID($mode); ?> <select class="form-control" id="<?php echo $mode; ?> _layout"> <option value="no"></option> <?php $dir = new DirectoryIterator($dire); foreach ($dir as $fileinfo) { // pr($fileinfo); if (!$fileinfo->isDot()) { ?> <option <?php if ($l->layout_file == $fileinfo->getBasename('.php')) { echo "selected"; } ?> value="<?php echo $fileinfo->getBasename('.php'); ?> "><?php echo $fileinfo->getBasename('.php'); ?> </option> <?php // var_dump($fileinfo->getFilename()); } } ?> </select> <script> $('#<?php echo $mode; ?> _layout').change(function () { var slc = $('#<?php echo $mode; ?> _layout').val(); // alert(slc); if (slc != 'no') $.post('<?php echo _LANGPATH; ?> LayoutBE/simpan', { id: '<?php echo $mode; ?> ', val: slc }, function (data) { //alert(data); asuccess(data); }); }); </script> <?php } ?> </td> </tr> <?php } } ?> </table> </div> <?php }