本文整理汇总了PHP中TemplateHandler::compile方法的典型用法代码示例。如果您正苦于以下问题:PHP TemplateHandler::compile方法的具体用法?PHP TemplateHandler::compile怎么用?PHP TemplateHandler::compile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TemplateHandler
的用法示例。
在下文中一共展示了TemplateHandler::compile方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: procSmartPhone
function procSmartPhone(&$oSmartPhone)
{
$prev_date = Context::get('prev_date');
if ($prev_date) {
$oSmartPhone->setPrevUrl(getUrl('date', $prev_date, 'document_srl', ''));
}
$next_date = Context::get('next_date');
if ($next_date) {
$oSmartPhone->setNextUrl(getUrl('date', $next_date, 'document_srl', ''));
}
$oTemplate = new TemplateHandler();
$content = $oTemplate->compile($this->module_path . 'tpl', 'smartphone');
$oSmartPhone->setContent($content);
}
示例2: procSmartPhone
function procSmartPhone(&$oSmartPhone)
{
if (!$this->grant->access) {
return $oSmartPhone->setContent(Context::getLang('msg_not_permitted'));
}
// 위젯을 1렬로 정렬
preg_match_all('!(<img)([^\\>]*)(widget=)([^\\>]*?)(\\>)!is', $this->module_info->content, $matches);
$content = '';
for ($i = 0, $c = count($matches[0]); $i < $c; $i++) {
$content .= preg_replace('/ style\\=\\"([^\\"]+)\\" /i', ' style="overflow:hidden;clear:both;margin:0 0 20px 0; _margin-right:10px;" ', $matches[0][$i]) . "\n\n";
}
Context::set('content', $content);
$oTemplate = new TemplateHandler();
$content = $oTemplate->compile($this->module_path . 'tpl', 'smartphone');
$oSmartPhone->setContent($content);
}
示例3: procSmartPhone
function procSmartPhone(&$oSmartPhone)
{
$oDocumentModel =& getModel('document');
if (!$this->grant->list || $this->module_info->consultation == 'Y') {
return $oSmartPhone->setContent(Context::getLang('msg_not_permitted'));
}
$oDocument = Context::get('oDocument');
if ($oDocument->isExists()) {
if (Context::get('comment') == 'true' && $oDocument->getCommentCount()) {
Context::set('comment_list', $oDocument->getComments());
$comment_page_navigation = $oDocument->comment_page_navigation;
if ($comment_page_navigation) {
if ($comment_page_navigation->cur_page > $comment_page_navigation->first_page) {
$oSmartPhone->setPrevUrl(getUrl('cpage', $comment_page_navigation->cur_page - 1));
}
if ($comment_page_navigation->cur_page < $comment_page_navigation->last_page) {
$oSmartPhone->setNextUrl(getUrl('cpage', $comment_page_navigation->cur_page + 1));
}
}
$oSmartPhone->setParentUrl(getUrl('comment', ''));
$tpl_file = 'comment_list';
} else {
$oSmartPhone->setParentUrl(getUrl('document_srl', ''));
$tpl_file = 'view_document';
}
} else {
$page_navigation = Context::get('page_navigation');
if ($page_navigation) {
if ($page_navigation->cur_page > $page_navigation->first_page) {
$oSmartPhone->setPrevUrl(getUrl('page', $page_navigation->cur_page - 1));
}
if ($page_navigation->cur_page < $page_navigation->last_page) {
$oSmartPhone->setNextUrl(getUrl('page', $page_navigation->cur_page + 1));
}
}
$tpl_file = 'list';
}
$oTemplate = new TemplateHandler();
$content = $oTemplate->compile($this->module_path . 'tpl/smartphone', $tpl_file);
$oSmartPhone->setContent($content);
}
示例4: getTextyleCommentPage
function getTextyleCommentPage()
{
$document_srl = Context::get('document_srl');
$oDocumentModel =& getModel('document');
if (!$document_srl) {
return new Object(-1, "msg_invalid_request");
}
$oDocument = $oDocumentModel->getDocument($document_srl);
if (!$oDocument->isExists()) {
return new Object(-1, "msg_invalid_request");
}
Context::set('oDocument', $oDocument);
$oTemplate = new TemplateHandler();
$html = $oTemplate->compile($this->getTemplatePath(), "comment.html");
$this->add("html", $html);
}
示例5: displayContent
/**
* @brief WAP content is available as a separate output if the final results
*/
function displayContent()
{
Context::set('layout', 'none');
// Compile a template
$oTemplate = new TemplateHandler();
$oContext =& Context::getInstance();
$content = $oTemplate->compile($this->oModule->getTemplatePath(), $this->oModule->getTemplateFile());
$this->setContent($content);
// Output
$this->display();
}
示例6: rss
//.........这里部分代码省略.........
$oModuleController->replaceDefinedLangCode($info->title);
$info->title = str_replace('\'', ''', $info->title);
if ($config->feed_description) {
$info->description = str_replace('\'', ''', htmlspecialchars($config->feed_description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
} else {
$info->description = str_replace('\'', ''', htmlspecialchars($this->module_info->description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
}
$info->link = getUrl('', 'mid', $mid);
$info->feed_copyright = str_replace('\'', ''', htmlspecialchars($feed_config->feed_copyright, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
if (!$info->feed_copyright) {
$info->feed_copyright = str_replace('\'', ''', htmlspecialchars($total_config->feed_copyright, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
}
}
}
}
if (!$info->title) {
if ($rss_title) {
$info->title = $rss_title;
} else {
if ($total_config->feed_title) {
$info->title = $total_config->feed_title;
} else {
$site_module_info = Context::get('site_module_info');
$info->title = $site_module_info->browser_title;
}
}
$oModuleController->replaceDefinedLangCode($info->title);
$info->title = str_replace('\'', ''', htmlspecialchars($info->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
$info->description = str_replace('\'', ''', htmlspecialchars($total_config->feed_description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
$info->link = Context::getRequestUri();
$info->feed_copyright = str_replace('\'', ''', htmlspecialchars($total_config->feed_copyright, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
}
if ($add_description) {
$info->description .= "\r\n" . $add_description;
}
if ($total_config->image) {
$info->image = Context::getRequestUri() . str_replace('\'', ''', htmlspecialchars($total_config->image, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
}
switch (Context::get('format')) {
case 'atom':
$info->date = date('Y-m-d\\TH:i:sP');
if ($mid) {
$info->id = getUrl('', 'mid', $mid, 'act', 'atom', 'page', Context::get('page'), 'start_date', Context::get('start_date'), 'end_date', Context::get('end_date'));
} else {
$info->id = getUrl('', 'module', 'rss', 'act', 'atom', 'page', Context::get('page'), 'start_date', Context::get('start_date'), 'end_date', Context::get('end_date'));
}
break;
case 'rss1.0':
$info->date = date('Y-m-d\\TH:i:sP');
break;
default:
$info->date = date("D, d M Y H:i:s") . ' ' . $GLOBALS['_time_zone'];
break;
}
if ($_SERVER['HTTPS'] == 'on') {
$proctcl = 'https://';
} else {
$proctcl = 'http://';
}
$temp_link = explode('/', $info->link);
if ($temp_link[0] == '' && $info->link) {
$info->link = $proctcl . $_SERVER['HTTP_HOST'] . $info->link;
}
$temp_id = explode('/', $info->id);
if ($temp_id[0] == '' && $info->id) {
$info->id = $proctcl . $_SERVER['HTTP_HOST'] . $info->id;
}
$info->language = str_replace('jp', 'ja', Context::getLangType());
// Set the variables used in the RSS output
Context::set('info', $info);
Context::set('feed_config', $config);
Context::set('open_rss_config', $open_rss_config);
Context::set('document_list', $document_list);
// Force the result output to be of XMLRPC
Context::setResponseMethod("XMLRPC");
// Perform the preprocessing function of the editor component as the results are obtained
$path = $this->module_path . 'tpl/';
//if($args->start_date || $args->end_date) $file = 'xe_rss';
//else $file = 'rss20';
switch (Context::get('format')) {
case 'xe':
$file = 'xe_rss';
break;
case 'atom':
$file = 'atom10';
break;
case 'rss1.0':
$file = 'rss10';
break;
default:
$file = 'rss20';
break;
}
$oTemplate = new TemplateHandler();
$content = $oTemplate->compile($path, $file);
Context::set('content', $content);
// Set the template file
$this->setTemplatePath($path);
$this->setTemplateFile('display');
}
示例7: procSmartPhone
function procSmartPhone(&$oSmartPhone)
{
$oTemplate = new TemplateHandler();
$content = $oTemplate->compile($this->module_path . 'tpl', 'smartphone');
$oSmartPhone->setContent($content);
}
示例8: getEditor
//.........这里部分代码省略.........
}
$colorset = $option->colorset;
Context::set('colorset', $colorset);
Context::set('skin', $skin);
if ($skin == 'dreditor') {
$this->loadDrComponents();
}
/**
* Check the automatic backup feature (do not use if the post is edited)
**/
if ($enable_autosave) {
// Extract auto-saved data
$saved_doc = $this->getSavedDoc($upload_target_srl);
// Context setting auto-saved data
Context::set('saved_doc', $saved_doc);
}
Context::set('enable_autosave', $enable_autosave);
/**
* Extract editor's unique number (in order to display multiple editors on a single page)
**/
if ($option->editor_sequence) {
$editor_sequence = $option->editor_sequence;
} else {
if (!$_SESSION['_editor_sequence_']) {
$_SESSION['_editor_sequence_'] = 1;
}
$editor_sequence = $_SESSION['_editor_sequence_']++;
}
/**
* Upload setting by using configuration of the file module internally
**/
$files_count = 0;
if ($allow_fileupload) {
$oFileModel =& getModel('file');
// Get upload configuration to set on SWFUploader
$file_config = $oFileModel->getUploadConfig();
$file_config->allowed_attach_size = $file_config->allowed_attach_size * 1024 * 1024;
$file_config->allowed_filesize = $file_config->allowed_filesize * 1024 * 1024;
Context::set('file_config', $file_config);
// Configure upload status such as file size
$upload_status = $oFileModel->getUploadStatus();
Context::set('upload_status', $upload_status);
// Upload enabled (internally caching)
$oFileController =& getController('file');
$oFileController->setUploadInfo($editor_sequence, $upload_target_srl);
// Check if the file already exists
if ($upload_target_srl) {
$files_count = $oFileModel->getFilesCount($upload_target_srl);
}
}
Context::set('files_count', (int) $files_count);
Context::set('allow_fileupload', $allow_fileupload);
// Set editor_sequence value
Context::set('editor_sequence', $editor_sequence);
// Set the document number to upload_target_srl for file attachments
// If a new document, upload_target_srl = 0. The value becomes changed when file attachment is requested
Context::set('upload_target_srl', $upload_target_srl);
// Set the primary key valueof the document or comments
Context::set('editor_primary_key_name', $option->primary_key_name);
// Set content column name to sync contents
Context::set('editor_content_key_name', $option->content_key_name);
/**
* Check editor component
**/
$site_module_info = Context::get('site_module_info');
$site_srl = (int) $site_module_info->site_srl;
if ($enable_component) {
if (!Context::get('component_list')) {
$component_list = $this->getComponentList(true, $site_srl);
Context::set('component_list', $component_list);
}
}
Context::set('enable_component', $enable_component);
Context::set('enable_default_component', $enable_default_component);
/**
* Variable setting if html_mode is available
**/
Context::set('html_mode', $html_mode);
/**
* Set a height of editor
**/
Context::set('editor_height', $editor_height);
// Check an option whether to start the editor manually
Context::set('editor_manual_start', $option->manual_start);
/**
* Set a skin path to pre-compile the template
?**/
$tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin);
$tpl_file = 'editor.html';
if (!file_exists($tpl_path . $tpl_file)) {
$skin = 'xpresseditor';
$tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin);
}
Context::set('editor_path', $tpl_path);
// load editor skin lang
Context::loadLang($tpl_path . 'lang');
// Return the compiled result from tpl file
$oTemplate = new TemplateHandler();
return $oTemplate->compile($tpl_path, $tpl_file);
}
示例9: getEditor
//.........这里部分代码省略.........
$skin = $option->skin;
if (!$skin) {
$skin = 'xpresseditor';
}
$colorset = $option->colorset;
Context::set('colorset', $colorset);
Context::set('skin', $skin);
/**
* 자동백업 기능 체크 (글 수정일 경우는 사용하지 않음)
**/
if ($enable_autosave) {
// 자동 저장된 데이터를 추출
$saved_doc = $this->getSavedDoc($upload_target_srl);
// 자동 저장 데이터를 context setting
Context::set('saved_doc', $saved_doc);
}
Context::set('enable_autosave', $enable_autosave);
/**
* 에디터의 고유 번호 추출 (한 페이지에 여러개의 에디터를 출력하는 경우를 대비)
**/
if ($option->editor_sequence) {
$editor_sequence = $option->editor_sequence;
} else {
if (!$GLOBALS['_editor_sequence_']) {
$GLOBALS['_editor_sequence_'] = 1;
}
$editor_sequence = $GLOBALS['_editor_sequence_']++;
}
/**
* 업로드 활성화시 내부적으로 file 모듈의 환경설정을 이용하여 설정
**/
$files_count = 0;
if ($allow_fileupload) {
$oFileModel =& getModel('file');
// SWFUploader에 세팅할 업로드 설정 구함
$file_config = $oFileModel->getUploadConfig();
$file_config->allowed_attach_size = $file_config->allowed_attach_size * 1024 * 1024;
$file_config->allowed_filesize = $file_config->allowed_filesize * 1024 * 1024;
Context::set('file_config', $file_config);
// 업로드 가능 용량등에 대한 정보를 세팅
$upload_status = $oFileModel->getUploadStatus();
Context::set('upload_status', $upload_status);
// upload가능하다고 설정 (내부적으로 캐싱하여 처리)
$oFileController =& getController('file');
$oFileController->setUploadInfo($editor_sequence, $upload_target_srl);
// 이미 등록된 파일이 있는지 검사
if ($upload_target_srl) {
$files_count = $oFileModel->getFilesCount($upload_target_srl);
}
}
Context::set('files_count', (int) $files_count);
Context::set('allow_fileupload', $allow_fileupload);
// 에디터 동작을 위한 editor_sequence값 설정
Context::set('editor_sequence', $editor_sequence);
// 파일 첨부 관련 행동을 하기 위해 문서 번호를 upload_target_srl로 설정
// 신규문서일 경우 upload_target_srl=0 이고 첨부파일 관련 동작이 요청될때 이 값이 변경됨
Context::set('upload_target_srl', $upload_target_srl);
// 문서 혹은 댓글의 primary key값을 세팅한다.
Context::set('editor_primary_key_name', $option->primary_key_name);
// 내용을 sync 맞추기 위한 content column name을 세팅한다
Context::set('editor_content_key_name', $option->content_key_name);
/**
* 에디터 컴포넌트 체크
**/
$site_module_info = Context::get('site_module_info');
$site_srl = (int) $site_module_info->site_srl;
if ($enable_component) {
if (!Context::get('component_list')) {
$component_list = $this->getComponentList(true, $site_srl);
Context::set('component_list', $component_list);
}
}
Context::set('enable_component', $enable_component);
Context::set('enable_default_component', $enable_default_component);
/**
* html_mode 가능한지 변수 설정
**/
Context::set('html_mode', $html_mode);
/**
* 에디터 세로 크기 설정
**/
Context::set('editor_height', $editor_height);
// 에디터의 초기화를 수동으로하는 것에 대한 값 체크
Context::set('editor_manual_start', $option->manual_start);
/**
* 템플릿을 미리 컴파일해서 컴파일된 소스를 하기 위해 스킨의 경로를 설정
**/
$tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin);
$tpl_file = 'editor.html';
if (!file_exists($tpl_path . $tpl_file)) {
$skin = 'xpresseditor';
$tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin);
}
Context::set('editor_path', $tpl_path);
// load editor skin lang
Context::loadLang($tpl_path . 'lang');
// tpl 파일을 compile한 결과를 return
$oTemplate = new TemplateHandler();
return $oTemplate->compile($tpl_path, $tpl_file);
}
示例10: getMobileexSubCommentList
/**
* @brief 서브 코멘트 리스트 컴파일
**/
function getMobileexSubCommentList()
{
$document_srl = Context::get('document_srl');
$targetModule = Context::get('target_module');
$targetSkin = Context::get('skin_name');
$paginate = Context::get('paginate');
// 추가해야함
$view_count = Context::get('view_count');
// 추가해야함
$up_category = Context::get('up_category');
// 추가해야함
if (!$paginate) {
$paginate = 1;
}
//기본값
if (!$view_count) {
$view_count = 20;
}
//기본값
if (!$up_category) {
return new Object(-1, "msg_invalid_request");
}
if (!$document_srl) {
return new Object(-1, "msg_invalid_request");
}
if (!$targetModule) {
return new Object(-1, "msg_invalid_request");
}
if (!$targetSkin) {
return new Object(-1, "msg_invalid_request");
}
$oDocumentModel =& getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl);
if (!$oDocument->isExists()) {
return new Object(-1, "msg_invalid_request");
}
Context::set('oDocument', $oDocument);
$oMobileexModel =& getModel('mobileex');
$comment_list = $oMobileexModel->getMobileexSubCommentList($up_category, $paginate, $view_count);
if (!$comment_list) {
return new Object(-1, "msg_invalid_request");
}
Context::set('comment_list', $comment_list->get('list'));
Context::set('total', $comment_list->get('total'));
$templatePath = sprintf('./modules/%s/m.skins/%s/compile', $targetModule, $targetSkin);
$oTemplate = new TemplateHandler();
$html = $oTemplate->compile($templatePath, "comment_sub_list.html");
$this->add("html", $html);
}
示例11: TemplateHandler
Context::set('module_info', $module_info);
Context::set('addon_info', $addon_info);
$logged_info = Context::get('logged_info');
Context::set('logged_info', $logged_info);
$addon_info->gg_skin = $addon_info->gg_skin ? $addon_info->gg_skin : 'default';
if ($module_info->module == 'board' && Context::get('document_srl')) {
$oDocument = $oDocumentModel->getDocument(Context::get('document_srl'));
$scrap_output = $oDocument->variables['content'];
}
if ($module_info->module == 'page') {
$oDocument = $oDocumentModel->getDocumentList($module_info);
$oDocument = $oDocument->data[1];
$scrap_output = $oDocument->variables['content'];
}
$oTemplate = new TemplateHandler();
$template_btn_text = $oTemplate->compile('./addons/ggwoorimailscrap/skins/' . $addon_info->gg_skin, 'index');
$btn_text = '<div style=text-align:' . $addon_info->text_align . ';width:100%;height:50px;z-index:99999;>' . $template_btn_text . '</div>';
$ggoutput = new stdClass();
if ($addon_info->text_position == 'top') {
$ggoutput = str_replace($scrap_output, $btn_text . $scrap_output, $output);
} else {
$ggoutput = str_replace($scrap_output, $scrap_output . $btn_text, $output);
}
$output = $ggoutput;
}
if ($called_position == 'before_display_content' && Context::get('ggtype') == 'ggwoorimailscrap') {
$config = new stdClass();
$config->w_serv_url = 'woorimail.com';
$config->w_ssl = $addon_info->w_ssl;
$config->w_ssl_port = '20080';
$config->w_authkey = $addon_info->w_authkey;