WEB언어/CodeIgniter
[CodeIgniter] 404 페이지 후에 back 버튼 달기
saltdoll
2018. 3. 10. 04:24
반응형
404 페이지에 back버튼 달기
출처: http://codeigniter-kr.org/bbs/view/qna?idx=9227
application/errors/ 디렉토리안의 error_404.php 파일에 back 버튼 달아보세요.
팁게시판 보시면 ci사랑님이 올려놓으신 alert helper가 있을겁니다.
그게 원하시는 역할을 해주는 헬퍼입니다.
//application/helpers/alert_helper.php <? if ( ! defined( 'BASEPATH' )) exit ( 'No direct script access allowed' ); // 경고메세지를 경고창으로 function alert( $msg = '' , $url = '' ) { $CI =& get_instance(); if (! $msg ) $msg = '올바른 방법으로 이용해 주십시오.' ; echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=" . $CI ->config->item( 'charset' ). "\">" ; echo "<script type='text/javascript'>alert('" . $msg . "');" ; if ( $url ) echo "location.replace('" . $url . "');" ; else echo "history.go(-1);" ; echo "</script>" ; exit ; } // 경고메세지 출력후 창을 닫음 function alert_close( $msg ) { $CI =& get_instance(); echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=" . $CI ->config->item( 'charset' ). "\">" ; echo "<script type='text/javascript'> alert('" . $msg . "'); window.close(); </script>" ; exit ; } // 경고메세지만 출력 function alert_only( $msg ) { $CI =& get_instance(); echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=" . $CI ->config->item( 'charset' ). "\">" ; echo "<script type='text/javascript'> alert('" . $msg . "'); </script>" ; exit ; } function alert_continue( $msg ){ $CI =& get_instance(); echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=" . $CI ->config->item( 'charset' ). "\">" ; echo "<script type='text/javascript'> alert('" . $msg . "'); </script>" ; } ?> |
반응형