<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
global $g5;

if($row1['me_type'] == 'faq' && $row1['me_link']){
    $partner_url = $row1['me_link'];
    $url = parse_url($partner_url);
    parse_str($url['query']);
}
if(!$bo_table){
  echo "FAQ 메뉴파입은 관리자화면 > OKonepage관리에서 게시판을 연결해 주세요.";
}
$faq_table = $g5['write_prefix'] . $bo_table;
?>
<!-- faq area start -->
<?php
//실제 적용에선 메뉴정보에서 보드를 불러와 반영..
$sql_faq = sql_query("select * from $faq_table order by wr_id desc limit 0,8");

$sql_faq_img = sql_fetch("select * from $faq_table order by wr_id asc limit 0,1");
 $faq_image = get_list_thumbnail($bo_table, $sql_faq_img['wr_id'], "587", "553");
 if($faq_image['src']) {
     $faq_img = '<img src="'.$faq_image['src'].'" alt="자주하는 질문">';
   } else {
     $faq_img = '<img src="http://fakeimg.pl/587x553/?text=FAQ" alt="자주하는 질문">';
   }
?>
<section id="menu<?php echo $j;?>" class="ok-faqs-section">
  <div class="container">
    <div class="row">
      <div class="col-md-6">
        <div class="ok-faqs-title">
          <h2 class="content-title">FAQ</h2>
        </div>
        <div class="ok-house-accourdion">
          <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
            <?php
        for ($i=0; $row_faq=sql_fetch_array($sql_faq); $i++) { ?>
            <div class="panel">
              <div class="card-header" role="tab" id="heading<?php echo $i;?>">
                <h4 class="card-title">
                    <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse<?php echo $i;?>" aria-expanded="true" aria-controls="collapse<?php echo $i;?>">
                    <?php echo $row_faq['wr_subject'];?>
                    </a>
                </h4>
              </div>
              <div id="collapse<?php echo $i;?>" class="panel-collapse collapse" role="tabpanel"
              aria-labelledby="heading<?php echo $i;?>">
                <div class="card-body">
                  <p><?php echo $row_faq['wr_content'];?></p>
                </div>
              </div>
            </div>
          <?php
        }?>

          </div>
        </div>
      </div>
      <div class="col-md-6">
        <div class="faq_img">
          <?php echo $faq_img;?>
        </div>
      </div>
    </div>
  </div>
</section>
<!-- faq area end -->
