글쓰기 버튼 클릭후 글을쓸때
본문
우측하단에 아래와 같이 글쓰기 버튼을 넣었습니다.
<?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
}
?>
!-->
답변을 작성하시기 전에 로그인 해주세요.