本文整理汇总了PHP中Templates::getTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP Templates::getTemplate方法的具体用法?PHP Templates::getTemplate怎么用?PHP Templates::getTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Templates
的用法示例。
在下文中一共展示了Templates::getTemplate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sanitize
<?php
$siteID = $this->request->parameters["site"];
$pageID = $this->request->parameters["page"];
$action = $this->request->parameters["action"];
$template = (int) sanitize($this->request->parameters["template"]);
$templateMgr = new Templates();
if ($template == 0 && $siteID && $pageID) {
if ($siteID == "mailing") {
$mailingMgr = new MailingMgr();
$mailing = $mailingMgr->getMailing($pageID);
$mailingInfo = $mailing->get();
$template = $mailingInfo["TEMPLATEID"];
} else {
$pageMgr = new PageMgr($siteID);
$page = $pageMgr->getPage($pageID);
$pageInfo = $page->get();
$template = $pageInfo["TEMPLATEID"];
}
} else {
$template = (int) sanitize($this->request->parameters["template"]);
}
if ($template != 0) {
$templateInfo = $templateMgr->getTemplate($template);
$templateInfo["PREVIEWPATH"] = $templateMgr->getPreviewPath($template);
} else {
$templateInfo = false;
}
$smarty->assign("templateInfo", $templateInfo);
$smarty->assign("mode", sanitize($this->request->parameters["mode"]));
$smarty->display("file:" . getrealpath($this->page_template));
示例2: renderPage
function renderPage($page, $version, $pageInfo, $pageMgr, $siteInfo)
{
$templateMgr = new Templates();
$pageID = $pageInfo["OBJECTID"];
$templateInfo = $templateMgr->getTemplate($pageInfo["TEMPLATEID"]);
$templatefilename = $templateInfo["FILENAME"];
$templatefullpath = $templateMgr->getDir() . $templateInfo["PATH"] . $templatefilename;
$content = $page->getContent();
// navi
$tree = $pageMgr->getList($pageID, array($filter));
$tree = $pageMgr->getAdditionalTreeInfo($pageID, $tree, true);
$oldlevel = 0;
for ($xt = 0; $xt < count($tree); $xt++) {
if ($oldlevel != $tree[$xt]["LEVEL"] || !$pnames) {
$tree[$xt]["PARENTS"] = $pnames = $pageMgr->getParents($tree[$xt]["ID"]);
$oldlevel = $tree[$xt]["LEVEL"];
} else {
$tree[$xt]["PARENTS"] = $pnames;
}
if ($pageID == $tree[$xt]["ID"]) {
$pageInfo["PARENTS"] = $pnames;
}
$url = "";
$pi = count($pnames);
while ($pi > 0) {
$url .= $pnames[$pi - 1][0]["PNAME"] . "/";
$pi--;
}
$tree[$xt]["PURL"] = $url . $tree[$xt]["PNAME"] . "/";
$tree[$xt]["URL"] = sApp()->webroot . $url . $tree[$xt]["PNAME"] . "/";
if ($tree[$xt]["HIDDEN"] == 0 && $tree[$xt]["SHOW"] == 1) {
$xtc = $xtc + 1;
}
}
$pageMgr->callExtensionHook("onRender", $siteInfo["ID"], $pageID, $version, array("FILTER" => $filter, "CONTENTAREAS" => &$content));
// Fill userinfo with data from current user
$currUser = new User(sUserMgr()->getCurrentUserID());
$userInfo = $currUser->get();
$userInfo['FULLNAME'] = trim($userInfo['FIRSTNAME'] . ' ' . $userInfo['LASTNAME']);
sApp()->smarty->assign("user", $userInfo);
sApp()->smarty->assign("devmode", (string) sApp()->devmode);
sApp()->smarty->assign("pageinfo", $pageInfo);
sApp()->smarty->assign("contentareas", $content);
sApp()->smarty->assign("tree", $tree);
sApp()->smarty->assign("site", $siteInfo["ID"]);
sApp()->smarty->assign("siteinfo", $siteInfo);
sApp()->smarty->assign("sitename", $siteInfo["PNAME"]);
sApp()->smarty->assign("untitledparams", sApp()->request->untitled_parameters);
if (!sApp()->output_tmp) {
if ($templateInfo == NULL) {
sApp()->output_tmp = "";
} else {
sApp()->output_tmp = sApp()->smarty->fetch("file:" . $templatefullpath);
}
}
//2nd pass
sApp()->smarty->left_delimiter = '[!';
sApp()->smarty->right_delimiter = '!]';
sApp()->output = sApp()->smarty->fetch("var:" . sApp()->output_tmp);
//3rd pass (replace special urls with normal urls)
sApp()->output = replaceSpecialURLs(sApp()->output);
echo sApp()->output;
}
示例3: sendEmail
public function sendEmail($emailData)
{
$mail = new PHPMailer();
if ((bool) sConfig()->getVar('CONFIG/MAILINGS/DISABLE')) {
return true;
}
// Obtain userdata
$user = new User($emailData['USER_ID']);
$userInfo = $user->get();
$userInfo['PROPERTIES'] = $user->properties->getValues($emailData['USER_ID']);
// Obtain mailingdata
$mailingMgr = new MailingMgr();
$mailing = $mailingMgr->getMailing($emailData['MAILING_ID']);
if ($emailData['IS_TEST']) {
$mailingInfo = $mailing->get();
$mailingVersion = $mailingInfo['VERSION'];
} else {
$mailingVersion = $mailing->getLatestApprovedVersion();
$mailing = $mailingMgr->getMailing($emailData['MAILING_ID'], $mailingVersion);
$mailingInfo = $mailing->get();
}
$templateMgr = new Templates();
$userId = $userInfo['ID'];
$userEmail = $userInfo['PROPERTIES']['EMAIL'];
$userFirstName = $userInfo['PROPERTIES']['FIRSTNAME'];
$userLastName = $userInfo['PROPERTIES']['LASTNAME'];
$userName = trim($userFirstName . ' ' . $userLastName);
$userCompany = $userInfo['PROPERTIES']['COMPANY'];
$userDepartment = $userInfo['PROPERTIES']['COMPANY'];
$templateInfo = $templateMgr->getTemplate($mailingInfo['TEMPLATEID']);
$userInfo['PROPERTIES']['FULLNAME'] = trim($userFirstName . ' ' . $userLastName);
sSmarty()->clear_assign('recipient');
sSmarty()->assign('recipient', $userInfo);
sSmarty()->clear_assign('user');
sSmarty()->assign('user', $userInfo['PROPERTIES']);
sApp()->output = '';
$emailData['FROM'] = $mailingInfo['FROM_EMAIL'];
$emailData['FROM_NAME'] = $mailingInfo['FROM_NAME'];
$emailData['FROM_REPLYTO'] = $mailingInfo['FROM_REPLYTO'];
$emailData['FROM_SENDER'] = $mailingInfo['FROM_SENDER'];
$emailData['ENCODING'] = $mailingInfo['ENCODING'];
if ($emailData['ENCODING'] == '') {
$emailData['ENCODING'] = 'base64';
}
$emailData['SUBJECT'] = $this->replaceUserdataVars($mailingInfo['SUBJECT'], $emailData['USER_ID']);
$emailData['BODY_TEXT'] = $this->replaceUserdataVars($mailingInfo['FALLBACK_TEXT'], $emailData['USER_ID']);
// Set special smarty delimiters
sSmarty()->left_delimiter = '[!';
sSmarty()->right_delimiter = '!]';
// Parse subject with smarty
$emailData['SUBJECT'] = sSmarty()->fetch('var:' . $emailData['SUBJECT']);
//$emailData['BODY_TEXT'] = sSmarty()->fetch('var:'.$emailData['BODY_TEXT']);
// Reset smarty delimiters
sSmarty()->left_delimiter = '{';
sSmarty()->right_delimiter = '}';
$mailingId = $emailData['MAILING_ID'];
include getrealpath(dirname(__FILE__) . '/../../output/mailing.php');
if ($templateInfo['FILENAME']) {
$emailhtml = sApp()->output;
$emailhtml = str_replace("\"/neptun/neptun.php", "\"" . $this->request->prefix . "://" . $this->request->http_host . $this->request->script_name, $emailhtml);
$emailhtml = $this->replaceUserdataVars($emailhtml, $emailData['USER_ID']);
$emailData['BODY_HTML'] = $emailhtml;
} else {
$emailData['BODY_HTML'] = NULL;
}
sApp()->output = '';
$smtpServer = (string) sConfig()->getVar('CONFIG/MAILINGS/SMTP');
if ($smtpServer) {
$mail->IsSMTP();
$mail->Host = $smtpServer;
}
if ($emailData['ENCODING']) {
$mail->Encoding = $emailData['ENCODING'];
}
if ($emailData['CHARSET']) {
$mail->CharSet = $emailData['CHARSET'];
}
if ($emailData['FROM']) {
$mail->From = $emailData['FROM'];
}
if ($emailData['FROM_NAME']) {
$mail->FromName = $emailData['FROM_NAME'];
}
if ($emailData['FROM_REPLYTO']) {
$mail->AddReplyTo($emailData['FROM_REPLYTO']);
}
if ($emailData['FROM_SENDER']) {
$mail->Sender = $emailData['FROM_SENDER'];
}
if ($emailData['SUBJECT']) {
$mail->Subject = $emailData['SUBJECT'];
}
if ($emailData['BODY_HTML']) {
$mail->Body = $emailData['BODY_HTML'];
$mail->IsHTML(true);
}
if ($emailData['BODY_TEXT'] && !$emailData['BODY_HTML']) {
$mail->Body = $emailData['BODY_TEXT'];
$mail->IsHTML(false);
}
//.........这里部分代码省略.........
示例4: explode
$ygid = $this->request->parameters['yg_id'];
$refresh = $this->request->parameters['refresh'];
$initload = $this->request->parameters['initload'];
$siteID = explode('-', $ygid);
$siteID = $siteID[0];
$siteMgr = new Sites();
$siteinfo = $siteMgr->get($siteID);
if ($siteinfo['FAVICON']) {
// Favicon is set, get all information about file
$file = sFileMgr()->getFile($siteinfo['FAVICON']);
if ($file) {
$favicon = $file->get();
$smarty->assign('favicon', $favicon);
}
}
$templateMgr = new Templates();
$templateInfo = $templateMgr->getTemplate($siteinfo['DEFAULTTEMPLATE']);
$templateInfo['PREVIEWPATH'] = $templateMgr->getPreviewPath($siteinfo['DEFAULTTEMPLATE']);
if ($siteinfo['TEMPLATEROOT']) {
$templaterootinfo = $templateMgr->getTemplate($siteinfo['TEMPLATEROOT']);
}
$smarty->assign('object', $siteID);
$smarty->assign('siteinfo', $siteinfo);
$smarty->assign('templateInfo', $templateInfo);
$smarty->assign('templaterootinfo', $templaterootinfo);
$smarty->assign('mode', 1);
$smarty->assign('refresh', $refresh);
$smarty->assign('initload', $initload);
$smarty->assign('win_no', $this->request->parameters['win_no']);
$smarty->display('file:' . $this->page_template);
示例5: sSites
$positive = $this->params['positive'];
// Check if template is still used
$stillInUse = false;
$sites = sSites()->getList();
foreach ($sites as $curr_site) {
$pageMgr = new PageMgr($curr_site['ID']);
$pages = $pageMgr->getPagesByTemplate($template);
if (count($pages) > 0) {
$stillInUse = true;
}
}
$mailings = sMailingMgr()->getMailingsByTemplate($template);
if (count($pages) > 0) {
$stillInUse = true;
}
$tmpTemplateInfo = $templateMgr->getTemplate($template);
if ($stillInUse) {
// Still used!
if ($confirmed != 'true') {
$parameters = array('template' => $template);
$koala->callJSFunction('Koala.yg_confirm', $itext['TXT_DELETE_USED_TEMPLATE_TITLE'] != '' ? $itext['TXT_DELETE_USED_TEMPLATE_TITLE'] : '$TXT_DELETE_USED_TEMPLATE_TITLE', $itext['TXT_DELETE_USED_TEMPLATE'] != '' ? $itext['TXT_DELETE_USED_TEMPLATE'] : '$TXT_DELETE_USED_TEMPLATE', $action, json_encode($parameters));
} else {
if ($confirmed == 'true' && $positive == 'true') {
$successfullyDeleted = $templateMgr->remove($template);
if (in_array($template, $successfullyDeleted)) {
if ($tmpTemplateInfo['FOLDER']) {
$jsQueue->add($template, HISTORYTYPE_TEMPLATE, 'OBJECT_DELETE', sGuiUS(), 'templatefolder', NULL, NULL, $template . '-template', 'name');
} else {
$jsQueue->add($template, HISTORYTYPE_TEMPLATE, 'OBJECT_DELETE', sGuiUS(), 'template', NULL, NULL, $template . '-template', 'name');
}
}
示例6: User
<?php
$ygid = $this->request->parameters['yg_id'];
$refresh = $this->request->parameters['refresh'];
$tmpUser = new User(sUserMgr()->getCurrentUserID());
$tmpUserInfo = $tmpUser->get();
$adminAllowed = $tmpUser->checkPermission('RMAILINGCONFIG');
if ($adminAllowed) {
$mailingMgr = new MailingMgr();
$templateMgr = new Templates();
$defaultTemplate = $mailingMgr->getDefaultTemplate();
$templateRoot = $mailingMgr->getTemplateRoot();
if ($defaultTemplate) {
$templateInfo = $templateMgr->getTemplate($defaultTemplate);
$templateInfo['PREVIEWPATH'] = $templateMgr->getPreviewPath($defaultTemplate);
}
if ($templateRoot) {
$templateRootInfo = $templateMgr->getTemplate($templateRoot);
}
}
$smarty->assign('mode', 1);
$smarty->assign('adminAllowed', $adminAllowed);
$smarty->assign('templateInfo', $templateInfo);
$smarty->assign('templaterootinfo', $templateRootInfo);
$smarty->assign('defaultTemplate', $defaultTemplate);
$smarty->assign('templateRoot', $templateRoot);
$smarty->assign('refresh', $refresh);
$smarty->assign('win_no', $this->request->parameters['win_no']);
$smarty->display('file:' . $this->page_template);
示例7: Templates
} else {
$filter = "PUBLISHED";
$mailingVersion = $mailing->getPublishedVersion(true);
}
} else {
$filter = "PUBLISHED";
$mailingVersion = $mailing->getPublishedVersion(true);
}
$mailing = $mailingMgr->getMailing($mailingId, $mailingVersion);
// Mailing Properties
$mailingInfo = $mailing->get();
$mailingProperties = $mailing->properties->get();
$mailingInfo = array_merge($mailingProperties, $mailingInfo);
// Template
$templateMgr = new Templates();
$templateInfo = $templateMgr->getTemplate($mailingInfo['TEMPLATEID']);
$templatefilename = $templateInfo['FILENAME'];
$templatefullpath = $templateMgr->getDir() . $templateInfo['PATH'] . $templatefilename;
// Content
$content = $mailing->getContent();
$mailingcnt = array('USERINFO' => $userInfo, 'FILTER' => $filter, 'CONTENTAREAS' => &$content);
$mailingMgr->callExtensionHook('onRender', $mailingId, $mailingVersion, $mailingcnt);
sSmarty()->assign('pageinfo', $mailingInfo);
sSmarty()->assign('contentareas', $content);
if (!$output_tmp) {
$output_tmp = sSmarty()->fetch('file:' . $templatefullpath);
}
// 2nd pass
sSmarty()->left_delimiter = '[!';
sSmarty()->right_delimiter = '!]';
sApp()->output = sSmarty()->fetch('var:' . $output_tmp);
示例8: sGuiUS
$koala->alert($itext['TXT_ERROR_ACCESS_DENIED']);
} else {
$value = str_replace("\n", '\\n', $value);
$jsQueue->add($data[0], HISTORYTYPE_TAG, 'OBJECT_CHANGE', sGuiUS(), 'tag', NULL, NULL, $this->reponsedata[$property]->yg_id, $property, $value);
$jsQueue->add($data[0], HISTORYTYPE_TAG, 'OBJECT_CHANGE', sGuiUS(), 'page', NULL, NULL, $this->reponsedata[$property]->yg_id, $property, $value);
// Special case for name
if ($property == 'name') {
$jsQueue->add($data[0], HISTORYTYPE_TAG, 'REFRESH_WINDOW', sGuiUS(), 'name');
$jsQueue->add($data[0], HISTORYTYPE_PAGE, 'REFRESH_WINDOW', sGuiUS(), 'name');
}
}
break;
case 'template':
// Get the template
$templateMgr = new Templates();
$templateInfo = $templateMgr->getTemplate($data[0]);
$oldname = $templateInfo['NAME'];
$value = str_replace("\r", '', str_replace("\n", '\\n', $this->reponsedata[$property]->value));
if ($oldname == $value) {
// No update needed, henceforth break
break;
}
// Check for empty name
if (trim($value) == '') {
//$jsQueue->add ($data[0], HISTORYTYPE_TEMPLATE, 'OBJECT_CHANGE', sGuiUS(), 'tag', NULL, NULL, $this->reponsedata[$property]->yg_id, $property, $oldvalue);
//$jsQueue->add ($data[0], HISTORYTYPE_FILE, 'REFRESH_WINDOW', sGuiUS(), 'name');
$koala->alert($itext['TXT_CANT_CHANGE_TEMPLATETITLE_TO_EMPTY_VALUE']);
break;
}
// Special handling for files
if ($propertyInfo[0]['TYPE'] == 'FILE') {