search.php파일로 검색창만 jquery Load메서드로 불러오고 싶습니다.

search.php파일로 검색창만 jquery Load메서드로 불러오고 싶습니다.

QA

search.php파일로 검색창만 jquery Load메서드로 불러오고 싶습니다.

본문

[search.php]
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가

if (G5_IS_MOBILE) {
    include_once(G5_THEME_MOBILE_PATH.'/head.php');
    return;
}

include_once(G5_THEME_PATH.'/head.sub.php');
include_once(G5_LIB_PATH.'/latest.lib.php');
include_once(G5_LIB_PATH.'/outlogin.lib.php');
include_once(G5_LIB_PATH.'/poll.lib.php');
include_once(G5_LIB_PATH.'/visit.lib.php');
include_once(G5_LIB_PATH.'/connect.lib.php');
include_once(G5_LIB_PATH.'/popular.lib.php');
?>
<link href="../css/style.css" rel="stylesheet" type="text/css">
<link href="../theme/basic/css/default.css" rel="stylesheet" type="text/css">
<body>
            <fieldset id="hd_sch"> 
                <legend>사이트 내 전체검색</legend>
                <form name="fsearchbox" method="get" action="<?php echo G5_BBS_URL ?>/search.php" onsubmit="return fsearchbox_submit(this);">
                <input type="hidden" name="sfl" value="wr_subject||wr_content">
                <input type="hidden" name="sop" value="and">
                <label for="sch_stx" class="sound_only">검색어 필수</label>
                    <span class="sch_stxWrapper">
                <input type="text" name="stx" id="sch_stx" maxlength="20">
                <button type="submit" id="sch_submit" value="검색" alt="검색" title="검색"><i class="fa fa-search" aria-hidden="true"></i><span class="sound_only">검색</span></button></span>
                </form>

                <script>
                function fsearchbox_submit(f)
                {
                    var stx = f.stx.value.trim();
                    if (stx.length < 2) {
                        alert("검색어는 두글자 이상 입력하십시오.");
                        f.stx.select();
                        f.stx.focus();
                        return false;
                    }

                    // 검색에 많은 부하가 걸리는 경우 이 주석을 제거하세요.
                    var cnt = 0;
                    for (var i = 0; i < stx.length; i++) {
                        if (stx.charAt(i) == ' ')
                            cnt++;
                    }

                    if (cnt > 1) {
                        alert("빠른 검색을 위하여 검색어에 공백은 한개만 입력할 수 있습니다.");
                        f.stx.select();
                        f.stx.focus();
                        return false;
                    }
                    f.stx.value = stx;

                    return true;
                }
                </script>

            </fieldset>
                

</body>


위 코드를

루트폴더/html/company.html에서

<script>
jQuery(document).ready(function(){
jQuery("#allheader").load('../theme/basic/search.php')
jQuery("#allfooter").load('./allfooter.html')
})
</script>

이렇게 불러왔는데 실패합니다.
./theme/basic/search.php

./../theme/basic/search.php
이렇게도 실패합니다. 

search.php 파일 내부에 코드가 누락된 것 같다는 생각이 들지만 어떻게 해야할지를 모르겠습니다.

 

참고로 루트폴더에 그누보드가 설치되어 있습니다. ./bbs, ./lib 등등

 
 

이 질문에 댓글 쓰기 :

답변 2

희한하게 작업하는군요

php코드를 그냥 불러다(include) 쓸 것이지 ajax로 불러다 쓰는 이유가 있는가요?

그리고 저런 php코드를 사용 가능 하려면 common.php를 상단 첫부분에 넣어야 합니다

============다음처럼 해보세요

company.php

<?php

include "_common.php";

?>

~~

~~

<div id="allheader"><?php include "<?php echo G5_THEME_PATH;?>/search.php");?></div>

 

 

 

 

라이브러리함수가 적용되어잇는상태라면 서브헤더가 또한 적용이되어있는상태여야하겟죠?안그렇면 벡엔드 설계하셔야합니다.

 

개발자 오류를 확인해보시기 바랍니다.

답변을 작성하시기 전에 로그인 해주세요.
전체 58
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT