moniwiki 프로젝트에 commit 하고 싶었는데... 개발자가 바쁜지 대답이 없어서 일단 위키에 먼저 공개한다.
1. wiki.php 를 수정해야 한다.
1.1 안드로이드/아이폰일 경우 테마 변수를 모바일 테마로 강제로 변환한다.
$this->set_theme(!empty($options['theme']) ? $options['theme'] : '');
위 소스를 아래 소스로 교체한다.
// mobile theme check, mobile
$ua = $_SERVER['HTTP_USER_AGENT'];
if( strpos($ua, "Android") || strpos($ua, "iPhone") ){
$this->set_theme("mobile");
}
else{
$this->set_theme(!empty($options['theme']) ? $options['theme'] : '');
}
1.2 헤더 정보에 메타 태그로 viewport 정보를 추가한다.
if ($theme_type == 2 or isset($options['retstr']))
ob_start();
else
echo "<head>\n";
위의 소스 다음에 아래 소스를 추가한다.
// mobile viewport setting. mobile
$ua = $_SERVER['HTTP_USER_AGENT'];
if( strpos($ua, "Android") || strpos($ua, "iPhone") ){
echo '<meta name="viewport" content="width=device-width"/>';
}
1.3 (1.1) 과 비슷한 내용이다. 모바일 모드에서 테마를 고정한다. 둘중 하나만 적용해도 될것 같은데 그냥 두개 다 설정하였다.
# MoniWiki theme
라인 다음에 다음 소스를 추가한다.
// mobile
$ua = $_SERVER['HTTP_USER_AGENT'];
if( strpos($ua, "Android") || strpos($ua, "iPhone") ){
$theme = "mobile";
}
2. 모바일 테마 파일이다.
theme 디렉토리에 다음 파일을 풀어준다.