本文整理汇总了PHP中Cx\Core\Html\Sigma::setTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP Sigma::setTemplate方法的具体用法?PHP Sigma::setTemplate怎么用?PHP Sigma::setTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cx\Core\Html\Sigma
的用法示例。
在下文中一共展示了Sigma::setTemplate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* Constructor
*
* Calls the parent constructor and creates a local template object
* @param $strPageContent string The content of the page as string.
* @param $queryParams array The constructor accepts an array parameter $queryParams, which will
* override the request parameters cmd and/or category, if given
* override the request parameters cmd and/or category
*/
function __construct($strPageContent, array $queryParams = array())
{
parent::__construct();
$objFWUser = \FWUser::getFWUserObject();
$this->userId = $objFWUser->objUser->login() ? $objFWUser->objUser->getId() : 0;
$this->parseURLModifiers($queryParams);
$this->objTemplate = new \Cx\Core\Html\Sigma('.');
\Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->objTemplate);
$this->objTemplate->setErrorHandling(PEAR_ERROR_DIE);
$this->objTemplate->setTemplate($strPageContent);
}
示例2: shadowbox
/**
* Show the shadowbox
*/
function shadowbox()
{
global $objDatabase, $_ARRAYLANG, $objInit;
$id = intval($_GET['id']);
$lang = intval($_GET['lang']);
$entries = $this->createEntryArray();
$entry = $entries[$id];
$settings = $this->createSettingsArray();
$title = $entry['translation'][$lang]['subject'];
$content = $entry['translation'][$lang]['content'];
$picture = !empty($entry['translation'][$lang]['image']) ? $entry['translation'][$lang]['image'] : "none";
$this->_objTpl = new \Cx\Core\Html\Sigma(ASCMS_THEMES_PATH);
\Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTpl);
$this->_objTpl->setCurrentBlock("shadowbox");
$objResult = $objDatabase->SelectLimit("\n SELECT foldername\n FROM " . DBPREFIX . "skins\n WHERE id='{$objInit->currentThemesId}'", 1);
if ($objResult !== false) {
$themesPath = $objResult->fields['foldername'];
}
$template = preg_replace('/\\[\\[([A-Z_]+)\\]\\]/', '{$1}', $settings['data_template_shadowbox']);
$this->_objTpl->setTemplate($template);
if ($entry['translation'][$lang]['attachment']) {
$this->_objTpl->setVariable(array("HREF" => $entry['translation'][$lang]['attachment'], "TXT_DOWNLOAD" => empty($entry['translation'][$lang]['attachment_desc']) ? $_ARRAYLANG['TXT_DATA_DOWNLOAD_ATTACHMENT'] : $entry['translation'][$lang]['attachment_desc']));
$this->_objTpl->parse("attachment");
}
$this->_objTpl->setVariable(array("TITLE" => $title, "CONTENT" => $content, "PICTURE" => $picture, "THEMES_PATH" => $themesPath));
if ($picture != "none") {
$this->_objTpl->parse("image");
} else {
$this->_objTpl->hideBlock("image");
}
$this->_objTpl->parse("shadowbox");
$this->_objTpl->show();
die;
}
示例3: showEcard
function showEcard()
{
global $objDatabase, $_ARRAYLANG;
$this->_objTpl->setTemplate($this->pageContent);
// Initialize variables
$code = contrexx_addslashes($_GET['code']);
// Get data from DB
$query = "\n SELECT *\n FROM " . DBPREFIX . "module_ecard_ecards\n WHERE code='{$code}'";
$objResult = $objDatabase->Execute($query);
// If entered code does match a record in db
if (!$objResult->EOF) {
$message = nl2br(htmlentities($objResult->fields['message'], ENT_QUOTES, CONTREXX_CHARSET));
$senderName = htmlentities($objResult->fields['senderName'], ENT_QUOTES, CONTREXX_CHARSET);
$senderEmail = $objResult->fields['senderEmail'];
$recipientName = htmlentities($objResult->fields['recipientName'], ENT_QUOTES, CONTREXX_CHARSET);
$recipientEmail = $objResult->fields['recipientEmail'];
$recipientsalutation = htmlentities($objResult->fields['salutation'], ENT_QUOTES, CONTREXX_CHARSET);
// Get right file extension
$globArray = glob(ASCMS_ECARD_SEND_ECARDS_PATH . '/' . $code . ".*");
$fileextension = substr($globArray[0], -4);
$selectedMotive = $code . $fileextension;
// Initialize DATA placeholder
$this->_objTpl->setVariable(array('ECARD_DATA' => '<strong>' . $senderName . '</strong> (<a href="mailto:' . $senderEmail . '">' . $senderEmail . '</a>) ' . $_ARRAYLANG['TXT_ECARD_HAS_SENT_YOU_AN_ECARD'], 'ECARD_MOTIVE' => '<img src="' . ASCMS_ECARD_SEND_ECARDS_WEB_PATH . '/' . $selectedMotive . '" alt="' . $selectedMotive . '" title="' . $selectedMotive . '" />', 'ECARD_FROM' => $_ARRAYLANG['TXT_ECARD_FROM'] . ' ' . $senderName, 'ECARD_MESSAGE' => $message, 'ECARD_SENDER_NAME' => $senderName, 'ECARD_SENDER_EMAIL' => $senderEmail, 'ECARD_RECIPIENT_SALUTATION' => $recipientsalutation, 'ECARD_RECIPIENT_NAME' => $recipientName, 'ECARD_RECIPIENT_EMAIL' => $recipientEmail));
} else {
// display error message
$this->_objTpl->setVariable(array('ECARD_MESSAGE' => $_ARRAYLANG['TXT_ECARD_WRONG_CODE'], 'ECARD_FROM' => $_ARRAYLANG['TXT_ECARD_CAN_NOT_BE_DISPLAYED']));
}
}
示例4: isset
/**
* Constructor
* @global mixed $objDatabase ADODB abstraction layer object
* @param string $pageContent HTML template (@see /index.php)
*/
function __construct($pageContent)
{
global $objDatabase;
$this->frontLang = isset($_GET['immoLang']) ? intval($_GET['immoLang']) : 1;
$objRS = $objDatabase->Execute(" SELECT count(1) as cnt FROM " . DBPREFIX . "module_immo_fieldname WHERE\n lang_id = 1 AND lower(name) LIKE '%aufzählung%'");
$this->_listingCount = $objRS->fields['cnt'];
$this->_objTpl = new \Cx\Core\Html\Sigma('.');
\Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTpl);
$this->_objTpl->setErrorHandling(PEAR_ERROR_DIE);
$this->_objTpl->setTemplate($pageContent);
if (function_exists('mysql_set_charset')) {
mysql_set_charset("utf8");
//this is important for umlauts
}
// initialise the session array
if (!isset($_SESSION['immo'])) {
$_SESSION['immo'] = array();
}
parent::__construct();
}
示例5: array
/**
* DEPRECATED and OBSOLETE. Use parse_products_blocks().
*
* Sets up a Product list in the given template string with all Products
* taken from the Category with the given ID
*
* Changes the $_REQUEST array temporarily and calls
* {@see view_product_overview()}, then restores the original request.
* On failure, the empty string is returned.
* @param string $content The template string
* @param integer $category_id The Category ID
* @return string The filled template string
* on success, the empty string
* otherwise
*/
static function get_products_block($content, $category_id)
{
global $objInit, $_ARRAYLANG;
$_ARRAYLANG += $objInit->loadLanguageData('Shop');
if (!\Cx\Core\Setting\Controller\Setting::init('Shop', 'config')) {
return false;
}
$original_REQUEST =& $_REQUEST;
self::$objTemplate = new \Cx\Core\Html\Sigma();
self::$objTemplate->setTemplate($content);
// You might add more parameters here!
$_REQUEST = array('catId' => $category_id);
$result = self::view_product_overview();
$_REQUEST =& $original_REQUEST;
if (!$result) {
return '';
// You might want the original $content back, maybe?
}
$content = self::$objTemplate->get();
return $content;
}
示例6: showNews
function showNews()
{
global $objDatabase, $_ARRAYLANG, $_LANGID;
$this->_objTpl->setTemplate($this->pageContent, true, true);
//feed path
$this->feedpath = \Env::get('cx')->getWebsiteFeedPath() . '/';
//active (with $_LANGID) categories
$query = "SELECT id,\n name\n FROM " . DBPREFIX . "module_feed_category\n WHERE status = '1'\n AND lang = '" . $_LANGID . "'\n ORDER BY pos";
if ($objResult = $objDatabase->Execute($query)) {
while (!$objResult->EOF) {
$cat_id[$objResult->fields['id']] = $objResult->fields['id'];
$cat_name[$objResult->fields['id']] = $objResult->fields['name'];
$objResult->MoveNext();
}
}
//active news
$query = "SELECT id,\n subid,\n name\n FROM " . DBPREFIX . "module_feed_news\n WHERE status = '1'\n ORDER BY pos";
$objResult = $objDatabase->Execute($query);
while (!$objResult->EOF) {
$news_subid[$objResult->fields['subid']][$objResult->fields['id']] = $objResult->fields['subid'];
$news_id[$objResult->fields['subid']][$objResult->fields['id']] = $objResult->fields['id'];
$news_name[$objResult->fields['subid']][$objResult->fields['id']] = $objResult->fields['name'];
$objResult->MoveNext();
}
//no empty categories
if (is_array($cat_id)) {
foreach ($cat_id as $x) {
if (!isset($news_id[$x])) {
unset($cat_id[$x]);
unset($cat_name[$x]);
}
}
}
if (count($cat_id) == 0) {
unset($cat_id);
}
//output structure
if (!is_array($cat_id)) {
if (!isset($_GET['cat']) and !isset($_GET['news'])) {
$this->_objTpl->setVariable('FEED_NO_NEWSFEED', $_ARRAYLANG['TXT_FEED_NO_NEWSFEED']);
} else {
\Cx\Core\Csrf\Controller\Csrf::header("Location: " . CONTREXX_DIRECTORY_INDEX . "?section=Feed");
}
} else {
if ($this->_objTpl->blockExists('feed_cat')) {
foreach ($cat_id as $x) {
//out cat
$this->_objTpl->setVariable('FEED_CAT_NAME', $cat_name[$x]);
//out news
foreach ($news_id[$x] as $y) {
$this->_objTpl->setVariable(array('FEED_NEWS_LINK' => CONTREXX_DIRECTORY_INDEX . '?section=Feed&cat=' . $news_subid[$x][$y] . '&news=' . $news_id[$x][$y], 'FEED_NEWS_NAME' => strip_tags($news_name[$x][$y])));
$this->_objTpl->parse('feed_news');
}
$this->_objTpl->parse('feed_cat');
}
}
// first access
if (!isset($_GET['cat']) and !isset($_GET['news'])) {
reset($cat_id);
$_GET['cat'] = current($cat_id);
reset($news_id[$_GET['cat']]);
$_GET['news'] = current($news_id[$_GET['cat']]);
/*
foreach($cat_id as $x)
{
$_GET['cat'] = $cat_id[$x];
foreach($news_id[$x] as $y)
{
$_GET['news'] = $news_id[$x][$y];
break;
}
break;
}*/
}
$getCat = intval($_GET['cat']);
$getNews = intval($_GET['news']);
//refresh control
$query = "SELECT time,\n cache\n FROM " . DBPREFIX . "module_feed_news\n WHERE id = '" . $getNews . "'\n AND subid = '" . $getCat . "'\n AND status = '1'";
$objResult = $objDatabase->Execute($query);
if ($objResult->RecordCount() == 0) {
\Cx\Core\Csrf\Controller\Csrf::header("Location: " . CONTREXX_DIRECTORY_INDEX . "?section=Feed");
die;
}
$old_time = $objResult->fields['time'] + $objResult->fields['cache'];
$time = time();
if ($time >= $old_time) {
$this->showNewsRefresh($getNews, $time, $this->feedpath);
}
$query = "SELECT name,\n filename,\n time,\n articles,\n image\n FROM " . DBPREFIX . "module_feed_news\n WHERE id = '" . $getNews . "'\n AND subid = '" . $getCat . "'\n AND status = '1'";
$objResult = $objDatabase->Execute($query);
//output selected news
$news_name = $objResult->fields['name'];
$this->_objTpl->setVariable(array('FEED_CAT' => $cat_name[$getCat], 'FEED_PAGE' => $news_name));
$filename = $this->feedpath . $objResult->fields['filename'];
//rss class
$rss = new \XML_RSS($filename);
$rss->parse();
//channel info
$out_title = strip_tags($rss->channel['title']);
//.........这里部分代码省略.........
示例7: testImageSeriesOption
public function testImageSeriesOption()
{
$urls = array('https://placekitten.com/1500/300');
$imageOption = new ImageSeriesOption('test', array(1 => 'Unit-Test'), array('urls' => $urls));
$backendTemplate = new Sigma();
$backendTemplate->setTemplate($this->template);
$imageOption->renderOptionField($backendTemplate);
$renderedTemplate = $backendTemplate->get();
foreach ($urls as $url) {
$this->assertTrue(strpos($renderedTemplate, $url) !== 0);
}
}
示例8: preContentLoad
/**
* Calls hooks before content is processed
* @todo Remove usage of globals
* @global null $moduleStyleFile
* @global type $plainCmd
* @global type $plainSection
* @global type $themesPages
* @global type $page_template
*/
protected function preContentLoad()
{
global $moduleStyleFile, $plainCmd, $plainSection, $themesPages, $page_template;
$this->ch->callPreContentLoadHooks();
if ($this->mode == self::MODE_FRONTEND) {
// load content.html template (or customized version)
$this->template->setTemplate($themesPages['index']);
$this->template->addBlock('CONTENT_FILE', 'page_template', $page_template);
// load application content template
$this->loadContentTemplateOfPage();
// Set global content variables.
$pageContent = $this->resolvedPage->getContent();
$this->parseGlobalPlaceholders($pageContent);
$pageContent = str_replace('{TITLE}', $this->resolvedPage->getTitle(), $pageContent);
//replace the {NODE_<ID>_<LANG>}- placeholders
\LinkGenerator::parseTemplate($pageContent);
$this->resolvedPage->setContent($pageContent);
$moduleStyleFile = null;
} else {
if ($this->mode == self::MODE_BACKEND) {
// Skip the nav/language bar for modules which don't make use of either.
// TODO: Remove language selector for modules which require navigation but bring their own language management.
if ($this->ch->isLegacyComponent($plainCmd)) {
$this->template->addBlockfile('CONTENT_OUTPUT', 'content_master', 'LegacyContentMaster.html');
}
$plainSection = $plainCmd;
}
}
}