테스트 사이트 - 개발 중인 베타 버전입니다

고수님들 부탁드립니다 _(__)_ 채택완료

하이여여염 9년 전 조회 2,861

} else{  if($fm_id==""){   if (substr($_GET['bo_table'],0,8)=='customer') {    include_once(G5_PATH.'/include/board/head9.php');   } else if (substr($_GET['bo_table'],0,7)=='counsel') {    include_once(G5_PATH.'/include/board/head10_2.php');   } else {    if($_SERVER['PHP_SELF']=='/gbbs/bbs/register_form.php') {     include_once(G5_PATH.'/include/board/headmember.php');    } else {     include_once(G5_PATH.'/include/board/head10_2.php');    }   } 

 

쌩초보입니다._(__)_ 위 소스를 보니

customer 일때 head9.php를 부르고. counsel일때 head10_2.php 를 부르는거 같습니다.

 

그런데

news일 때 head10_3.php이랑 community일때 head10_4.php도 추가해서 부르고싶습니다.

 

어떻게 해야하는건지...날밤새도 제 머리론 답이 안나오네요. 부탁드립니다..

 

0,8    0,7이라는 건 대체 어떤걸 의미하는건가요.. 

댓글을 작성하려면 로그인이 필요합니다.

답변 2개

채택된 답변
+20 포인트
p
9년 전

substr 은 문자열 자르기 입니다. 

get 으로 가져온 bo_table 의 시작점부터 7자리까지 잘랐을 때 해당 값이 저 문자열일 경우라는 기준으로 작성된것으로 보입니다만 비효율적으로 보입니다.

strpos 로 체크하는걸 추천드립니다.

http://php.net/manual/kr/function.strpos.php">http://php.net/manual/kr/function.strpos.php

또 new 를 추가하고자 하신다면 

else if (substr($_GET['bo_table'],0,7)=='counsel') {
   include_once(G5_PATH.'/include/board/head10_2.php');
  }

해당 부분 아래에 추가하시면 됩니다.

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

else{  if($fm_id==""){   if (substr($_GET['bo_table'],0,8)=='customer') {    include_once(G5_PATH.'/include/board/head9.php');   } else if (substr($_GET['bo_table'],0,7)=='counsel') {    include_once(G5_PATH.'/include/board/head10_2.php');   }      else if (substr($_GET['bo_table'],0,8)=='news') {    include_once(G5_PATH.'/include/board/head9_2.php');   }           else {    if($_SERVER['PHP_SELF']=='/gbbs/bbs/register_form.php') {     include_once(G5_PATH.'/include/board/headmember.php');    } else {     include_once(G5_PATH.'/include/board/head10_2.php');    }   }   

포트 고수님 답변주셔서 감사합니다. 위처럼 중간에 저걸 넣었는데 head9_2.php를 불러오질 않구.

head10_2.php를 불러오는데.. 잘못되었나요? ~ 

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

p
port443
9년 전
news 는 4자라서 0,4 로 문자열을 자르셔야합니다.

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인