채택완료

테마 여러개를 한 계정에서 보기

2018-12-21 (금) 16:51:53 4,428

한 계정안에 테마를 A,B, C 요렇게 3개정도 있다고 했을때...

게시물은 다동일하게 보일테고 단지 테마형만 다르게 보이게 하고 싶은데...

샘플 제작된 홈페이지를 여러개 만들어서 보여주고 싶은데.... 각 홈페이지마다 재설치해서 보여주기는 좀 불편해보이고 좀 좋은 방법 없을까요?

|

답변 3개

채택된 답변
+20 포인트

관리자모드의 

/adm/theme_preview.php?theme=테마명

화일 참고하시어 작업하시면 될것 같습니다. 

/로 복사하시어 권한 부분만 확인하시면 될것 같습니다.

복사후 화일 상단에

Copy
// 테마
function get_theme_dir()
{
    $result_array = array();

    $dirname = G5_PATH.'/'.G5_THEME_DIR.'/';
    $handle = opendir($dirname);
    while ($file = readdir($handle)) {
        if($file == '.'||$file == '..') continue;

        if (is_dir($dirname.$file)) {
            $theme_path = $dirname.$file;
            if(is_file($theme_path.'/index.php') && is_file($theme_path.'/head.php') && is_file($theme_path.'/tail.php'))
                $result_array[] = $file;
        }
    }
    closedir($handle);
    natsort($result_array);

    return $result_array;
}


// 테마정보
function get_theme_info($dir)
{
    $info = array();
    $path = G5_PATH.'/'.G5_THEME_DIR.'/'.$dir;

    if(is_dir($path)) {
        $screenshot = $path.'/screenshot.png';
        if(is_file($screenshot)) {
            $size = @getimagesize($screenshot);

            if($size[2] == 3)
                $screenshot_url = str_replace(G5_PATH, G5_URL, $screenshot);
        }

        $info['screenshot'] = $screenshot_url;

        $text = $path.'/readme.txt';
        if(is_file($text)) {
            $content = file($text, false);
            $content = array_map('trim', $content);

            preg_match('#^Theme Name:(.+)$#i', $content[0], $m0);
            preg_match('#^Theme URI:(.+)$#i', $content[1], $m1);
            preg_match('#^Maker:(.+)$#i', $content[2], $m2);
            preg_match('#^Maker URI:(.+)$#i', $content[3], $m3);
            preg_match('#^Version:(.+)$#i', $content[4], $m4);
            preg_match('#^Detail:(.+)$#i', $content[5], $m5);
            preg_match('#^License:(.+)$#i', $content[6], $m6);
            preg_match('#^License URI:(.+)$#i', $content[7], $m7);

            $info['theme_name'] = trim($m0[1]);
            $info['theme_uri'] = trim($m1[1]);
            $info['maker'] = trim($m2[1]);
            $info['maker_uri'] = trim($m3[1]);
            $info['version'] = trim($m4[1]);
            $info['detail'] = trim($m5[1]);
            $info['license'] = trim($m6[1]);
            $info['license_uri'] = trim($m7[1]);
        }

        if(!$info['theme_name'])
            $info['theme_name'] = $dir;
    }

    return $info;
}
// 테마설정 정보
function get_theme_config_value($dir, $key='*')
{
    $tconfig = array();

    $theme_config_file = G5_PATH.'/'.G5_THEME_DIR.'/'.$dir.'/theme.config.php';
    if(is_file($theme_config_file)) {
        include($theme_config_file);

        if($key == '*') {
            $tconfig = $theme_config;
        } else {
            $keys = array_map('trim', explode(',', $key));
            foreach($keys as $v) {
                $tconfig[$v] = trim($theme_config[$v]);
            }
        }
    }

    return $tconfig;
}

추가하시면 되겠습니다.

테마 미리보기 페이지 생성하기
https://sir.kr/g5_tip/7147

해당 url뒤에 ?theme=테마명 형식으로

파라미터를 넘겨주고

head.php 파일 부분에서

넘어온 테마명이 하단에 적용되도록 하시면됩니다.

이런 작업을 많이해봣는데 설명을 드리리가 힘드네요

답변을 작성하려면 로그인이 필요합니다.