本文整理汇总了PHP中Contao\BackendTemplate::parse方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendTemplate::parse方法的具体用法?PHP BackendTemplate::parse怎么用?PHP BackendTemplate::parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contao\BackendTemplate
的用法示例。
在下文中一共展示了BackendTemplate::parse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate
/**
* Do not display the module if there are no articles
*
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE') {
/** @var BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### ' . Utf8::strtoupper($GLOBALS['TL_LANG']['FMD']['articlenav'][0]) . ' ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
/** @var PageModel $objPage */
global $objPage;
$this->objArticles = \ArticleModel::findPublishedWithTeaserByPidAndColumn($objPage->id, $this->strColumn);
// Return if there are no articles
if ($this->objArticles === null) {
return '';
}
// Redirect to the first article if no article is selected
if (!\Input::get('articles')) {
if (!$this->loadFirst) {
return '';
}
/** @var ArticleModel $objArticle */
$objArticle = $this->objArticles->current();
$strAlias = $objArticle->alias ?: $objArticle->id;
$this->redirect($this->generateFrontendUrl($objPage->row(), '/articles/' . $strAlias));
}
return parent::generate();
}
示例2: generate
/**
* Display a wildcard in the back end
*
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE') {
/** @var BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### ' . Utf8::strtoupper($GLOBALS['TL_LANG']['FMD']['rssReader'][0]) . ' ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
$this->objFeed = new \SimplePie();
$arrUrls = \StringUtil::trimsplit('[\\n\\t ]', trim($this->rss_feed));
if (count($arrUrls) > 1) {
$this->objFeed->set_feed_url($arrUrls);
} else {
$this->objFeed->set_feed_url($arrUrls[0]);
}
$this->objFeed->set_output_encoding(\Config::get('characterSet'));
$this->objFeed->set_cache_location(TL_ROOT . '/system/tmp');
$this->objFeed->enable_cache(false);
if ($this->rss_cache > 0) {
$this->objFeed->enable_cache(true);
$this->objFeed->set_cache_duration($this->rss_cache);
}
if (!$this->objFeed->init()) {
$this->log('Error importing RSS feed "' . $this->rss_feed . '"', __METHOD__, TL_ERROR);
return '';
}
$this->objFeed->handle_content_type();
return parent::generate();
}
示例3: addBackendAdminMenu
public function addBackendAdminMenu($strBuffer, $strTemplate)
{
if ($strTemplate != 'be_main' || !\BackendUser::getInstance()->isAdmin) {
return $strBuffer;
}
// replace the scripts before processing -> https://code.google.com/archive/p/phpquery/issues/212
$arrScripts = StringUtil::replaceScripts($strBuffer);
$objDoc = \phpQuery::newDocumentHTML($arrScripts['content']);
$objMenu = new BackendTemplate($this->strTemplate);
$arrActions = array();
$arrActiveActions = deserialize(\Config::get('backendAdminMenuActiveActions'), true);
foreach (empty($arrActiveActions) ? array_keys(\Config::get('backendAdminMenuActions')) : $arrActiveActions as $strAction) {
$arrActionData = $GLOBALS['TL_CONFIG']['backendAdminMenuActions'][$strAction];
$objAction = new BackendTemplate($this->strEntryTemplate);
$objAction->setData($arrActionData);
// href = callback?
if (is_array($arrActionData['href']) || is_callable($arrActionData['href'])) {
$strClass = $arrActionData['href'][0];
$strMethod = $arrActionData['href'][1];
$objInstance = \Controller::importStatic($strClass);
$objAction->href = $objInstance->{$strMethod}();
}
$objAction->class = $strAction;
$arrActions[] = $objAction->parse();
}
$objMenu->actions = $arrActions;
$objDoc['#tmenu']->prepend($objMenu->parse());
$strBuffer = StringUtil::unreplaceScripts($objDoc->htmlOuter(), $arrScripts['scripts']);
// avoid double escapings introduced by phpquery :-(
$strBuffer = preg_replace('@&([^;]{2,4};)@i', '&$1', $strBuffer);
return $strBuffer;
}
示例4: generate
/**
* Display a wildcard in the back end
*
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE') {
/** @var BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### ' . Utf8::strtoupper($GLOBALS['TL_LANG']['FMD']['newsarchive'][0]) . ' ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
$this->news_archives = $this->sortOutProtected(\StringUtil::deserialize($this->news_archives));
// No news archives available
if (!is_array($this->news_archives) || empty($this->news_archives)) {
return '';
}
// Show the news reader if an item has been selected
if ($this->news_readerModule > 0 && (isset($_GET['items']) || \Config::get('useAutoItem') && isset($_GET['auto_item']))) {
return $this->getFrontendModule($this->news_readerModule, $this->strColumn);
}
// Hide the module if no period has been selected
if ($this->news_jumpToCurrent == 'hide_module' && !isset($_GET['year']) && !isset($_GET['month']) && !isset($_GET['day'])) {
return '';
}
return parent::generate();
}
示例5: generate
/**
* Logout the current user and redirect
*
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE') {
/** @var BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### ' . Utf8::strtoupper($GLOBALS['TL_LANG']['FMD']['logout'][0]) . ' ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
// Set last page visited
if ($this->redirectBack) {
$_SESSION['LAST_PAGE_VISITED'] = $this->getReferer();
}
$this->import('FrontendUser', 'User');
$strRedirect = \Environment::get('base');
// Redirect to last page visited
if ($this->redirectBack && !empty($_SESSION['LAST_PAGE_VISITED'])) {
$strRedirect = $_SESSION['LAST_PAGE_VISITED'];
} elseif ($this->jumpTo && ($objTarget = $this->objModel->getRelated('jumpTo')) !== null) {
$strRedirect = $this->generateFrontendUrl($objTarget->row());
}
// Log out and redirect
if ($this->User->logout()) {
$this->redirect($strRedirect);
}
return '';
}
示例6: generate
/**
* Do not show the module if no calendar has been selected
*
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE') {
/** @var BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### ' . Utf8::strtoupper($GLOBALS['TL_LANG']['FMD']['calendar'][0]) . ' ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
$this->cal_calendar = $this->sortOutProtected(\StringUtil::deserialize($this->cal_calendar, true));
// Return if there are no calendars
if (!is_array($this->cal_calendar) || empty($this->cal_calendar)) {
return '';
}
$this->strUrl = preg_replace('/\\?.*$/', '', \Environment::get('request'));
$this->strLink = $this->strUrl;
if ($this->jumpTo && ($objTarget = $this->objModel->getRelated('jumpTo')) instanceof PageModel) {
/** @var PageModel $objTarget */
$this->strLink = $objTarget->getFrontendUrl();
}
return parent::generate();
}
示例7: generate
/**
* Display a wildcard in the back end
*
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE') {
/** @var BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### ' . Utf8::strtoupper($GLOBALS['TL_LANG']['FMD']['listing'][0]) . ' ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
// Return if the table or the fields have not been set
if ($this->list_table == '' || $this->list_fields == '') {
return '';
}
// Disable the details page
if (\Input::get('show') && $this->list_info == '') {
return '';
}
// Fallback to the default template
if ($this->list_layout == '') {
$this->list_layout = 'list_default';
}
$this->strTemplate = $this->list_layout;
$this->list_where = $this->replaceInsertTags($this->list_where, false);
$this->list_info_where = $this->replaceInsertTags($this->list_info_where, false);
return parent::generate();
}
示例8: generate
/**
* Display a wildcard in the back end
*
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE') {
/** @var BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### ' . Utf8::strtoupper($GLOBALS['TL_LANG']['FMD']['eventreader'][0]) . ' ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
// Set the item from the auto_item parameter
if (!isset($_GET['events']) && \Config::get('useAutoItem') && isset($_GET['auto_item'])) {
\Input::setGet('events', \Input::get('auto_item'));
}
// Do not index or cache the page if no event has been specified
if (!\Input::get('events')) {
/** @var PageModel $objPage */
global $objPage;
$objPage->noSearch = 1;
$objPage->cache = 0;
return '';
}
$this->cal_calendar = $this->sortOutProtected(\StringUtil::deserialize($this->cal_calendar));
// Do not index or cache the page if there are no calendars
if (!is_array($this->cal_calendar) || empty($this->cal_calendar)) {
/** @var PageModel $objPage */
global $objPage;
$objPage->noSearch = 1;
$objPage->cache = 0;
return '';
}
return parent::generate();
}
示例9: generateWildcard
/**
* Generate wildcard template for backend output.
*
* @return string
*/
protected function generateWildcard()
{
$objTemplate = new BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### ' . strtoupper($GLOBALS['TL_LANG']['FMD'][$this->type][0]) . ' ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
示例10: generate
/**
* Display a wildcard in the back end
*
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE') {
/** @var BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### ' . Utf8::strtoupper($GLOBALS['TL_LANG']['FMD']['comments'][0]) . ' ###';
$objTemplate->title = $this->headline;
return $objTemplate->parse();
}
return parent::generate();
}
示例11: generatePurgeField
/**
* Generate the purge cache field
*
* @return string
*/
public function generatePurgeField()
{
System::loadLanguageFile('tl_maintenance');
$template = new BackendTemplate('be_vimeo_rebuilder_user');
$template->elementsCount = count(Rebuilder::getContentElements());
if (($stats = Rebuilder::generateStats()) !== null) {
foreach ($stats as $k => $v) {
$template->{$k} = $v;
}
}
return $template->parse();
}
示例12: generate
/**
* Remove name attributes in the back end so the form is not validated
*
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE') {
/** @var BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### ' . Utf8::strtoupper($GLOBALS['TL_LANG']['CTE']['form'][0]) . ' ###';
$objTemplate->id = $this->id;
$objTemplate->link = $this->title;
$objTemplate->href = 'contao/main.php?do=form&table=tl_form_field&id=' . $this->id;
return $objTemplate->parse();
}
return parent::generate();
}
示例13: generate
public function generate()
{
if (TL_MODE == 'BE') {
$objTemplate = new BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### UNTERNEHEMEN DETAILS ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
return parent::generate();
}
示例14: writeCSS
/**
* create/update CSS File
* file :: web/bundles/swatchbook/css/divElements.css
*/
public function writeCSS()
{
$this->syncSwatchbookColors();
$objTemplate = new BackendTemplate('be_swatchbookSync');
$objTemplate->hrefBack = ampersand(str_replace('&key=sync', '', \Environment::get('request')));
$objTemplate->goBack = $GLOBALS['TL_LANG']['MSC']['goBack'];
if (!$this->isUpdate) {
$objTemplate->headline = $GLOBALS['TL_LANG']['swatchbook']['syncHeadlineNo'];
return $objTemplate->parse();
} else {
/**
* load File if doesn`t exists
*/
$file = new \File('src/CtEye/swatchbook-bundle/src/Resources/public/css/divElements.css');
/**
* result Color
*/
$groupPallets = \Database::getInstance()->execute("SELECT pid,count(pid) AS count FROM tl_swatchbookColors GROUP BY pid")->fetchAllAssoc();
$pallets = \Database::getInstance()->execute("SELECT id,pid,title,color FROM tl_swatchbookColors")->fetchAllAssoc();
foreach ($groupPallets as $c) {
$i = 1;
foreach ($pallets as $v) {
if ($c['pid'] == $v['pid']) {
$pal[$v['pid']] = $v['pid'];
$css[] = sprintf("#sb-container-%s div:nth-child(%s){background-color: #%s;box-shadow: -1px -1px 3px rgba(0,0,0,0.1), %spx %spx %spx rgba(0,0,0,0.1);-webkit-box-shadow: -1px -1px 3px rgba(0,0,0,0.1), %spx %spx %spx rgba(0,0,0,0.1);-moz-box-shadow: -1px -1px 3px rgba(0,0,0,0.1), %spx %spx %spx rgba(0,0,0,0.1);}", $v['pid'], $i <= $c['count'] ? $i : $c['count'], $v['color'], $v['id'], $v['id'], $v['id'], $v['id'], $v['id'], $v['id'], $v['id'], $v['id'], $v['id']);
$i++;
}
}
}
/**
* write CSS content
*/
\File::putContent('src/CtEye/swatchbook-bundle/src/Resources/public/css/divElements.css', implode("\n", $css));
$objTemplate->headline = $GLOBALS['TL_LANG']['swatchbook']['syncHeadline'];
$objTemplate->pallets = $i > 1 ? sprintf($GLOBALS['TL_LANG']['swatchbook']['syncPalletMulti'], $i) : sprintf($GLOBALS['TL_LANG']['swatchbook']['syncPalletSingle'], $i);
return $objTemplate->parse();
}
}
示例15: generate
/**
* Display a wildcard in the back end
*
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE') {
/** @var BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### ' . Utf8::strtoupper($GLOBALS['TL_LANG']['FMD']['sitemap'][0]) . ' ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
return parent::generate();
}