PHP Class Xpressengine\Theme\ThemeHandler
## 테마 조회
### 테마 아이디로 테마 조회하기
getTheme 메소드를 사용하여 테마 아이디로 테마를 조회할 수 있습니다.
php
$id = 'theme/myname@mytheme';
$theme = Theme::getTheme($id);
### 모든 테마 조회하기
getAllTheme 메소드를 사용하여 모든 테마 목록을 조회할 수 있습니다.
php
$themes = Theme::getAllTheme();
만약 모바일이나 데스크탑 버전을 지원하는 테마 목록을 조회하려면
getAllThemeSupportingMobile,
getAllThemeSupportingDesktop 메소드를 사용하십시오.
php
$mobileThemes = Theme::getAllThemeSupportingMobile();
$desktopThemes = Theme::getAllThemeSupportingDesktop();
### 관리페이지용 테마 조회하기
XpressEngine은 관리페이지에서 사용되는 테마도 교체 가능합니다. 관리페이지용 테마도 ThemeHandler를 사용하여 조회할 수 있습니다.
하나의 관리페이지용 테마를 조회할 때에는
getTheme를 동일하게 사용할 수 있습니다.
php
$id = 'settingsTheme/myname@mysettingstheme';
$settingsTheme = Theme::getTheme($id)
모든 관리페이지용 테마 목록을 조회할 때에는
getAllSettingsTheme를 사용하십시오.
php
$settingsThemes = Theme::getAllSettingsTheme();
## 사용할 테마 지정하기
XpressEngine에서는 브라우저로부터 요청을 받을 때마다, 응답할 Html을 생성할 때 하나의 테마를 사용합니다.
이때 사용할 테마를 지정해주어야 합니다. (대부분의 경우 XpressEngine 코어에서 자동으로 사용할 테마를 지정해줍니다.)
### 특정 테마를 사용
특정 테마를 응답시 사용하려면
selectTheme 메소드를 사용하십시오.
php
$id = 'theme/myname@mytheme';
Theme::selectTheme($id);
### 사이트 기본 테마 사용하기
XpressEngine은 아무 테마도 사용할 테마로 지정돼 있지 않을 경우, 기본으로 사용할 테마를 지정해놓고 있습니다.
> 사이트관리페이지의 설정 > 사이트 기본설정 메뉴에서 지정할 수 있습니다.
사이트 기본 테마로 지정된 테마를 사용하고 싶을 경우에는
selectSiteTheme를 사용하십시오.
php
응답시 사이트 기본 테마가 사용됨
Theme::selectSiteTheme();
### 테마 사용 안하기
만약 응답시 아무 테마도 출력되지 않도록 하려면
selectBlankTheme 메소드를 사용할 수 있습니다. 테마를 사용하지 않을 경우 순수한 컨텐츠 영역만 출력됩니다.
php
응답시 테마 사용 안함.
Theme::selectBlankTheme();
### 지정된 테마 정보 조회
현재 요청에 대한 응답시 사용하기로 지정된 테마를 조회할 수 있습니다.
getSelectedTheme 메소드를 사용하십시오.
php
$selected = Theme::getSelectedTheme();
## 테마 설정
테마는 사이트 제목, 로고, 출력할 메뉴와 같이 출력할 때 필요한 설정 정보를 사이트 관리자로부터 입력받을 수 있도록 설정 페이지를 제공합니다.
그리고 설정 페이지로부터 입력된 설정 정보를 ThemeHandler를 통해 데이터베이스에 저장하고, 저장된 정보를 조회할 수 있습니다.
> 설정 페이지에 대한 자세한 사항은 '테마 만들기' 매뉴얼을 참고하십시오.
### 테마 설정정보 조회하기
getThemeConfig 메소드를 사용하면 특정 테마의 설정 정보를 조회할 수 있습니다.
php
$id = 'theme/myname@mytheme';
$configs = Theme::getThemeConfig($id);
### 테마 설정정보 저장하기
반대로
setThemeConfig 메소드를 사용하면 특정 테마의 설정 정보를 조회할 수 있습니다.
php
$id = 'theme/myname@mytheme';
$configs = [
'site_title' => '내 사이트',
'main_menu' => $menuID,
];
Theme::setThemeConfig($id, $configs);
Afficher le fichier
Open project: xpressengine/xpressengine
Class Usage Examples
Méthodes publiques
Protected Properties
Méthodes publiques
Méthodes protégées
Method Details
__construct()
public méthode
public __construct ( PluginRegister $register, ConfigManager $config, Illuminate\Contracts\View\Factory $viewFactory, string $blankTheme ) |
$register |
Xpressengine\Plugin\PluginRegister |
plugin registry manager |
$config |
Xpressengine\Config\ConfigManager |
config manager |
$viewFactory |
Illuminate\Contracts\View\Factory |
view factory |
$blankTheme |
string |
blanktheme_id |
deselectTheme()
public méthode
alias for selectBlankTheme()
getAllSettingsTheme()
public méthode
getAllTheme()
public méthode
getAllThemeSupportingDesktop()
public méthode
getAllThemeSupportingDesktop
getAllThemeSupportingMobile()
public méthode
getAllThemeSupportingMobile
getCachePath()
public méthode
getConfigId()
public méthode
config id for given theme
getMobileResolver()
public méthode
현재 요청이 모바일 버전인지 조회할 때 사용되는 resolver를 조회한다.
getSelectedTheme()
public méthode
현재 Request에서 사용되는 테마를 반환한다. 반환되는 테마는 일반 테마일 수도 있고, 관리페이지용 테마일수도 있다.
getSiteThemeId()
public méthode
getTheme()
public méthode
등록된 테마중 주어진 id를 가진 테마를 반환한다.
public getTheme ( string $instanceId ) : ThemeEntity |
$instanceId |
string |
조회할 테마의 id |
Résultat |
ThemeEntity |
|
getThemeConfig()
public méthode
주어진 테마에 저장된 config data를 반환한다.
getThemeConfigList()
public méthode
주어진 테마에 저장된 모든 config data를 반환한다.
getViewFactory()
public méthode
public getViewFactory ( ) : Illuminate\Contracts\View\Factory |
Résultat |
Illuminate\Contracts\View\Factory |
|
hasCache()
public méthode
hasThemeConfig()
public méthode
주어진 테마가 저장된 config data를 가지고 있는지 검사한다.
makeEntity()
protected méthode
make and return ThemeEntity
selectBlankTheme()
public méthode
아무 테마도 지정하지 않는다. 내부적으로는 blankTheme를 지정한다.
selectSiteTheme()
public méthode
mode가 지정되지 않았을 경우 mobile resolver로부터 mode를 구한다.
mode가 지정돼 있을 경우 해당 mode의 테마를 지정한다.
selectTheme()
public méthode
현재 Request에서 사용될 테마를 지정한다. 이 메소드를 이용하여 테마를 지정하면, theme middleware에서 지정된 테마를 자동으로 출력한다.
setCachePath()
public méthode
setMobileResolver()
public méthode
현재 요청이 모바일 버전인지 조회할 때 사용되는 resolver를 지정한다.
setSiteTheme()
public méthode
사이트 기본 테마를 지정한다. 사이트 기본 테마 정보는 데이터베이스에 저장 된다.
setThemeConfig()
public méthode
주어진 테마의 config data를 저장한다.
Property Details
$blankTheme protected_oe property
$cachePath protected_oe property
$config protected_oe property
Config 저장소. 각 테마의 설정정보를 저장하고 있다.
$configDelimiter public_oe property
$configKey protected_oe property
Theme config를 조회/저장할 때 Config 저장소에서 사용될 key
$mobileResolver protected_oe property
현재 요청이 모바일 버전인지 조회할 때 사용되는 resolver
protected $mobileResolver |
$register protected_oe property
Register. 등록된 테마 목록을 저장하고 있다.
$selectedTheme protected_oe property
현재 요청(Request)에서 사용하기로 지정 돼 있는 테마
$selectedThemeId protected_oe property
현재 요청(Request)에서 사용하기로 지정 돼 있는 테마의 id
protected $selectedThemeId |
$themeList protected_oe property
$viewFactory protected_oe property
protected Factory,Illuminate\Contracts\View $viewFactory |
Résultat |
Illuminate\Contracts\View\Factory |
|