Skip to content
Docs

Developer guide

Frequently used core classes

A curated list of core classes and functions often used in third-party development. It's not a full specification but a map of "what to find where." Framework classes live in the Zittme\Framework\ namespace (Rhymix\Framework\ also works for compatibility).

Context: between the request and the screen

$value = Context::get('key');          // 요청 변수·설정값 읽기
Context::set('items', $list);          // 템플릿으로 값 넘기기
Context::get('is_logged');             // 로그인 여부
Context::get('logged_info');           // 로그인 회원 정보
Context::setBrowserTitle('제목');
Context::addBodyClass('my-class');
Context::loadLang('modules/foo/lang');

Note: Context::set() overwrites a request variable of the same name. For form values in proc actions, reading $_POST directly is safer.

DB

$output = executeQuery('모듈.쿼리명', $args);       // 단건 성격
$output = executeQueryArray('모듈.쿼리명', $args);  // 결과 항상 배열
$srl = getNextSequence();                            // 고유 번호 발급

Check success with $output->toBool(), and on failure return $output as is to pass along the error message. For details, see Query XML.

Module info

ModuleModel::getModuleInfoByMid($mid);     // mid의 인스턴스 정보
ModuleModel::isIDExists($mid);             // mid 중복 확인
ModuleModel::getModuleConfig('모듈명');     // 모듈 전역 설정
getController('module')->insertModuleConfig('모듈명', $config);  // 설정 저장
ModuleModel::loadSkinInfo($path, $skin);   // 스킨 메타데이터 (responsive 포함)

Members

MemberModel::getMemberInfoByMemberSrl($member_srl);
MemberModel::getGroups();                  // 회원 그룹 목록
$logged_info = Context::get('logged_info');
$logged_info->is_admin === 'Y';            // 최고관리자 여부
$logged_info->group_list;                  // 소속 그룹 (키 = group_srl)

Cache: Zittme\Framework\Cache

use Zittme\Framework\Cache;

$data = Cache::get('mykey');
Cache::set('mykey', $data, 300);           // 300초
Cache::delete('mykey');
Cache::clearGroup('모듈명');                // 그룹 단위 비우기

Cache heavy lookups, but don't forget to clear the related cache in actions that change data.

Files: Zittme\Framework\Storage

use Zittme\Framework\Storage;

Storage::exists($path);
Storage::createDirectory($path);
Storage::move($from, $to);
Storage::delete($path);
Storage::isDirectory($path);

Path constants: RX_BASEDIR (install root), RX_BASEURL, RX_TIME (request time). By convention, files go in a per-module folder under files/.

Mail: Zittme\Framework\MailTemplate

The core's shared mail template. It reads the site name, address, and accent color from settings to give mail a consistent look.

use Zittme\Framework\MailTemplate;

$body = MailTemplate::wrap('제목', $content_html);
$table = MailTemplate::infoTable(['항목' => '값']);
$button = MailTemplate::button('확인하기', $url);

Frequently used global functions

FunctionPurpose
getUrl(...) / getNotEncodedUrl(...)Build a URL (differs in encoding)
getNotEncodedFullUrl(...)Full URL including domain
lang('key')Language string
escape($str)HTML escaping
zdate($ymdhis, 'Y-m-d')Format a YYYYMMDDHHIISS string
getNextSequence()Unique number
toBool($val)Convert conventional notations such as Y/N to boolean
isCrawler()Whether the visitor is a search bot

Make a habit of checking existence

If you need an API not listed here, confirm it actually exists in the core source before using it. Guessing and calling a similar-sounding name is a major cause of third-party errors. The fastest way is to find code in core modules (board, member, document) that does the same thing and follow it.