글쓰기 버튼 클릭후 글을쓸때

글쓰기 버튼 클릭후 글을쓸때

QA

글쓰기 버튼 클릭후 글을쓸때

본문

우측하단에 아래와 같이 글쓰기 버튼을 넣었습니다.


<?php if($member['mb_level'] >= '2') { // 2레벨이상 회원 ?>
<div style="position: fixed; right: 12px; bottom: 80px;z-index:9999">
                <div>
                <a href="<?php echo $write_href ?>" style="margin-bottom:10px"><img src="<?php echo G5_THEME_IMG_URL ?>/post2.png" alt="POST"  style="width:70px"></a><br>
                </div>
</div>
<? } ?>

근데 글을 쓰러 들어가면 사라지지 않고 그대로 표시되고 있습니다.

아마 따라다니게 해놓아서 그런데, 어떻게 해야 클릭후 글작성 페이지에서 안보이게 할수 있을까요?

이 질문에 댓글 쓰기 :

답변 1

다음과 같이 조건문을 추가하면 가능하지 않을까 생각합니다.


<?php
// 현재 페이지 URL을 가져오는 함수
$current_url = $_SERVER['REQUEST_URI'];
// 글쓰기 페이지 URL 패턴
$write_page_patterns = array(
    'write.php',
    'board.php?action=write'
);
// 현재 페이지가 글쓰기 페이지인지 여부 확인
$is_write_page = false;
foreach ($write_page_patterns as $pattern) {
    if (strpos($current_url, $pattern) !== false) {
        $is_write_page = true;
        break;
    }
}
// 회원 레벨이 2 이상이고 글쓰기 페이지가 아닌 경우에만 버튼 표시
if ($member['mb_level'] >= '2' && !$is_write_page) { 
?>
    <div style="position: fixed; right: 12px; bottom: 80px; z-index: 9999;">
        <div>
            <a href="<?php echo $write_href ?>" style="margin-bottom:10px;"><img src="<?php echo G5_THEME_IMG_URL ?>/post2.png" alt="POST" style="width:70px;"></a><br>
        </div>
    </div>
<?php 
}
?>

 

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

회원로그인

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