https://sir.kr/g5_tip/18640 해당 팁의 css, js 파일의 수정 시간을 verison에 수정하는 기능을 그누보드에서 제공하는 add_stylesheet와 add_javascript의 방법을 수정해서 올려드립니다.
common.lib.php파일을 열어서 아래 부분을 찾아서 변경해주시면 되겠습니다.
function add_stylesheet($stylesheet, $order=0)
{
global $html_process;
$patten = "/<link[^>]*href=[\"']?([^>\"']+)[\"']?[^>]*>/i";
preg_match_all($patten, $stylesheet, $match);
$file = $match[1][0];
if(strpos($file, G5_URL) !== false) {
$file_location = str_replace(G5_URL, '', $file);
$file_real_location = G5_PATH.'/'.$file_location;
if (file_exists($file_real_location)) {
$file_ver = "?ver=".date( 'YmdHis', filemtime($file_real_location));
}
$stylesheet = str_replace($file, $file.$file_ver, stripslashes($stylesheet));
}
if(trim($stylesheet) && method_exists($html_process, 'merge_stylesheet'))
$html_process->merge_stylesheet($stylesheet, $order);
}
function add_javascript($javascript, $order=0)
{
global $html_process;
$patten = "/<script[^>]*src=[\"']?([^>\"']+)[\"']?[^>]*>/i";
preg_match_all($patten, $javascript, $match);
$file = $match[1][0];
if(strpos($file, G5_URL) !== false) {
$file_location = str_replace(G5_URL, '', $file);
$file_real_location = G5_PATH.'/'.$file_location;
if (file_exists($file_real_location)) {
$file_ver = "?ver=".date( 'YmdHis', filemtime($file_real_location));
}
$javascript = str_replace($file, $file.$file_ver, stripslashes($javascript));
}
if(trim($javascript) && method_exists($html_process, 'merge_javascript'))
$html_process->merge_javascript($javascript, $order);
}
게시글 목록
| 번호 | 제목 |
|---|---|
| 23966 | |
| 23963 | |
| 23953 | |
| 23949 | |
| 23938 | |
| 23935 | |
| 23933 | |
| 23928 | |
| 23919 | |
| 23918 | |
| 23917 | |
| 23910 | |
| 23902 | |
| 23901 | |
| 23897 | |
| 23894 | |
| 23893 | |
| 23891 | |
| 23885 | |
| 23872 | |
| 23870 | |
| 23862 | |
| 23859 | |
| 23853 | |
| 23845 | |
| 23838 | |
| 23827 | |
| 23819 | |
| 23805 | |
| 23801 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기