그누보드 [G5] 기본형 그누보드를 반응형으로 만들기
페이지 정보
본문
여러 테마를 사용할 기회가 있기 때문에 무조건 테마사용으로 합니다.
그누보드5 / plugin / bootstrap / 3.3.6
그누보드5 / config.php
그누보드5 / theme / basic / head.sub.php
그누보드5 / theme / basic / tail.sub.php
그누보드5 / skin / 반응형 스킨
1. 그누보드5 / config.php
define('G5_USE_MOBILE', false);
2. 부트스트랩을 사용하기 위해 추가해 줍니다.
http://getbootstrap.com/getting-started/#download 에서 Source code 를 다운받아 아래 위치에 업로드
그누보드5 / plugin / bootstrap / 3.3.6
3-1. 그누보드5 / theme / basic / head.sub.php
<?php
if (G5_IS_MOBILE) {
echo '<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=0,maximum-scale=10,user-scalable=yes">'.PHP_EOL;
echo '<meta name="HandheldFriendly" content="true">'.PHP_EOL;
echo '<meta name="format-detection" content="telephone=no">'.PHP_EOL;
} else {
echo '<meta http-equiv="imagetoolbar" content="no">'.PHP_EOL;
echo '<meta http-equiv="X-UA-Compatible" content="IE=10,chrome=1">'.PHP_EOL;
}
를 다음과 같이 변경
if (G5_IS_MOBILE) {
echo '<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=0,maximum-scale=10,user-scalable=yes">'.PHP_EOL;
echo '<meta name="HandheldFriendly" content="true">'.PHP_EOL;
echo '<meta name="format-detection" content="telephone=no">'.PHP_EOL;
} else {
echo '<meta name="viewport" content="width=device-width, initial-scale=1">'.PHP_EOL;
echo '<meta http-equiv="imagetoolbar" content="no">'.PHP_EOL;
echo '<meta http-equiv="X-UA-Compatible" content="IE=10,chrome=1">'.PHP_EOL;
}
3-2. 그누보드5 / theme / basic / head.sub.php
웹폰트 아이콘을 사용하기 위해 추가
<link rel="stylesheet" href="<?php echo G5_THEME_CSS_URL; ?>/<?php echo G5_IS_MOBILE ? 'mobile' : 'default'; ?>.css">
를 다음과 같이 변경
<?php
if (defined('G5_IS_ADMIN')) {
if(!defined('_THEME_PREVIEW_'))
echo '<link rel="stylesheet" href="'.G5_ADMIN_URL.'/css/admin.css">'.PHP_EOL;
} else {
//echo '<link rel="stylesheet" href="'.G5_THEME_CSS_URL.'/'.(G5_IS_MOBILE?'mobile':'default').'.css">'.PHP_EOL;
echo '<link rel="stylesheet" href="'.G5_THEME_CSS_URL.'/default.css">'.PHP_EOL;
}
echo '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">'.PHP_EOL;
?>
3-3. 그누보드5 / theme / basic / head.sub.php
<!--[if lte IE 8]>
<script src="<?php echo G5_JS_URL ?>/html5.js"></script>
<![endif]-->
를 다음과 같이 변경
<!--[if lte IE 8]>
<script src="<?php echo G5_JS_URL ?>/html5.js"></script>
<![endif]-->
<?php if(!defined('G5_IS_ADMIN')) { ?>
<!-- Bootstrap core CSS -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<!-- Bootstrap theme -->
<link href="<?php echo G5_PLUGIN_URL?>/bootstrap/3.3.6/dist/css/bootstrap-theme.css" rel="stylesheet">
<!-- Custom styles for this template -->
<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
<!--[if lt IE 9]><script src="<?php echo G5_THEME_URL?>/assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<script src="<?php echo G5_URL?>/bootstrap/3.3.6/assets/js/ie-emulation-modes-warning.js"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<?php } ?>
4. 그누보드5 / theme / basic / tail.sub.php
관리자페이지는 부트스트랩을 사용하지 않기위해 추가
<?php if ($is_admin == 'super') { ?><!-- <div style='float:left; text-align:center;'>RUN TIME : <?php echo get_microtime()-$begin_time; ?><br></div> --><?php } ?>
를 다음과 같이 변경
<?php if(!defined('G5_IS_ADMIN')) { ?>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="<?php echo G5_PLUGIN_URL?>/bootstrap/3.3.6/assets/js/docs.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="<?php echo G5_PLUGIN_URL?>/bootstrap/3.3.6/assets/js/ie10-viewport-bug-workaround.js"></script>
<?php } ?>
<?php if ($is_admin == 'super') { ?><!-- <div style='float:left; text-align:center;'>RUN TIME : <?php echo get_microtime()-$begin_time; ?><br></div> --><?php } ?>
5. 반응형으로 코딩 다시 하기
자료출처
http://sir.kr/g5_tip/3910
그누보드5 / plugin / bootstrap / 3.3.6
그누보드5 / config.php
그누보드5 / theme / basic / head.sub.php
그누보드5 / theme / basic / tail.sub.php
그누보드5 / skin / 반응형 스킨
1. 그누보드5 / config.php
define('G5_USE_MOBILE', false);
2. 부트스트랩을 사용하기 위해 추가해 줍니다.
http://getbootstrap.com/getting-started/#download 에서 Source code 를 다운받아 아래 위치에 업로드
그누보드5 / plugin / bootstrap / 3.3.6
3-1. 그누보드5 / theme / basic / head.sub.php
<?php
if (G5_IS_MOBILE) {
echo '<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=0,maximum-scale=10,user-scalable=yes">'.PHP_EOL;
echo '<meta name="HandheldFriendly" content="true">'.PHP_EOL;
echo '<meta name="format-detection" content="telephone=no">'.PHP_EOL;
} else {
echo '<meta http-equiv="imagetoolbar" content="no">'.PHP_EOL;
echo '<meta http-equiv="X-UA-Compatible" content="IE=10,chrome=1">'.PHP_EOL;
}
를 다음과 같이 변경
if (G5_IS_MOBILE) {
echo '<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=0,maximum-scale=10,user-scalable=yes">'.PHP_EOL;
echo '<meta name="HandheldFriendly" content="true">'.PHP_EOL;
echo '<meta name="format-detection" content="telephone=no">'.PHP_EOL;
} else {
echo '<meta name="viewport" content="width=device-width, initial-scale=1">'.PHP_EOL;
echo '<meta http-equiv="imagetoolbar" content="no">'.PHP_EOL;
echo '<meta http-equiv="X-UA-Compatible" content="IE=10,chrome=1">'.PHP_EOL;
}
3-2. 그누보드5 / theme / basic / head.sub.php
웹폰트 아이콘을 사용하기 위해 추가
<link rel="stylesheet" href="<?php echo G5_THEME_CSS_URL; ?>/<?php echo G5_IS_MOBILE ? 'mobile' : 'default'; ?>.css">
를 다음과 같이 변경
<?php
if (defined('G5_IS_ADMIN')) {
if(!defined('_THEME_PREVIEW_'))
echo '<link rel="stylesheet" href="'.G5_ADMIN_URL.'/css/admin.css">'.PHP_EOL;
} else {
//echo '<link rel="stylesheet" href="'.G5_THEME_CSS_URL.'/'.(G5_IS_MOBILE?'mobile':'default').'.css">'.PHP_EOL;
echo '<link rel="stylesheet" href="'.G5_THEME_CSS_URL.'/default.css">'.PHP_EOL;
}
echo '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">'.PHP_EOL;
?>
3-3. 그누보드5 / theme / basic / head.sub.php
<!--[if lte IE 8]>
<script src="<?php echo G5_JS_URL ?>/html5.js"></script>
<![endif]-->
를 다음과 같이 변경
<!--[if lte IE 8]>
<script src="<?php echo G5_JS_URL ?>/html5.js"></script>
<![endif]-->
<?php if(!defined('G5_IS_ADMIN')) { ?>
<!-- Bootstrap core CSS -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<!-- Bootstrap theme -->
<link href="<?php echo G5_PLUGIN_URL?>/bootstrap/3.3.6/dist/css/bootstrap-theme.css" rel="stylesheet">
<!-- Custom styles for this template -->
<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
<!--[if lt IE 9]><script src="<?php echo G5_THEME_URL?>/assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<script src="<?php echo G5_URL?>/bootstrap/3.3.6/assets/js/ie-emulation-modes-warning.js"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<?php } ?>
4. 그누보드5 / theme / basic / tail.sub.php
관리자페이지는 부트스트랩을 사용하지 않기위해 추가
<?php if ($is_admin == 'super') { ?><!-- <div style='float:left; text-align:center;'>RUN TIME : <?php echo get_microtime()-$begin_time; ?><br></div> --><?php } ?>
를 다음과 같이 변경
<?php if(!defined('G5_IS_ADMIN')) { ?>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="<?php echo G5_PLUGIN_URL?>/bootstrap/3.3.6/assets/js/docs.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="<?php echo G5_PLUGIN_URL?>/bootstrap/3.3.6/assets/js/ie10-viewport-bug-workaround.js"></script>
<?php } ?>
<?php if ($is_admin == 'super') { ?><!-- <div style='float:left; text-align:center;'>RUN TIME : <?php echo get_microtime()-$begin_time; ?><br></div> --><?php } ?>
5. 반응형으로 코딩 다시 하기
자료출처
http://sir.kr/g5_tip/3910
댓글목록
등록된 댓글이 없습니다.