本文整理汇总了PHP中FrontendTemplate::parse方法的典型用法代码示例。如果您正苦于以下问题:PHP FrontendTemplate::parse方法的具体用法?PHP FrontendTemplate::parse怎么用?PHP FrontendTemplate::parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrontendTemplate
的用法示例。
在下文中一共展示了FrontendTemplate::parse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addCookiebarBuffer
/**
* Add the cookie HTML buffer
* @param string
* @return string
*/
public function addCookiebarBuffer($strContent)
{
if ($this->isCookiebarEnabled()) {
$objRoot = $this->getCurrentRootPage();
$objTemplate = new \FrontendTemplate('cookiebar_default');
$objTemplate->message = $objRoot->cookiebar_message;
$objTemplate->position = $objRoot->cookiebar_position;
$objTemplate->button = $objRoot->cookiebar_button;
$objTemplate->cookie = $this->getCookiebarName($objRoot);
$objTemplate->more = '';
// Add the "more" link
if ($objRoot->cookiebar_jumpTo > 0) {
$objJump = \PageModel::findByPk($objRoot->cookiebar_jumpTo);
if ($objJump !== null) {
$objJump->loadDetails();
$objTemplate->more = $GLOBALS['TL_LANG']['MSC']['more'];
$objTemplate->moreHref = ampersand($this->generateFrontendUrl($objJump->row(), null, $objJump->language));
$objTemplate->moreTitle = specialchars($GLOBALS['TL_LANG']['MSC']['more']);
}
}
// Place the cookiebar in DOM structure
if ($objRoot->cookiebar_placement === 'before_wrapper') {
$strContent = str_replace('<div id="wrapper">', $objTemplate->parse() . '<div id="wrapper">', $strContent);
} else {
$strContent = str_replace('</body>', $objTemplate->parse() . '</body>', $strContent);
}
}
return $strContent;
}
示例2: generateComments
/**
* Generate the comments and return them as HTML string
* @param string
* @param mixed
* @return string
*/
public static function generateComments($strShortname, $varIdentifier = null)
{
$objTemplate = new \FrontendTemplate('disqus');
$objTemplate->shortname = $strShortname;
$objTemplate->identifier = $varIdentifier;
return $objTemplate->parse();
}
示例3: inject
public function inject($strBuffer, $strTemplate)
{
// check for appId and version in config
if (!$GLOBALS['TL_CONFIG']['fb_app_id'] || !$GLOBALS['TL_CONFIG']['fb_app_version']) {
return $strBuffer;
}
// check for frontend or backend template
if (stripos($strTemplate, 'fe_') === false && stripos($strTemplate, 'be_main') === false) {
return $strBuffer;
}
// check for <body
if (stripos($strBuffer, '<body') === false) {
return $strBuffer;
}
// determine language string
$lang = $GLOBALS['TL_LANGUAGE'];
if (strlen($lang) == 2) {
$lang = strtolower($lang) . '_' . strtoupper($lang);
} else {
$lang = str_replace('-', '_', $lang);
}
// create the template
$objTemplate = new \FrontendTemplate('facebook-js-sdk');
// set data
$objTemplate->appId = $GLOBALS['TL_CONFIG']['fb_app_id'];
$objTemplate->version = $GLOBALS['TL_CONFIG']['fb_app_version'];
$objTemplate->lang = $lang;
// search for body and inject template
$strBuffer = preg_replace("/(<body.*>)/", "\$1" . $objTemplate->parse(), $strBuffer);
// return the buffer
return $strBuffer;
}
示例4: generateAddActions
public function generateAddActions($arrData, $id, Watchlist $objWatchlist)
{
global $objPage;
if ($objPage === null) {
return;
}
if (\Validator::isUuid($id)) {
$objFile = \FilesModel::findByUuid($id);
} else {
$objFile = \FilesModel::findBy('path', $id);
}
$objItem = new WatchlistItemModel();
$objItem->pid = Watchlist::getInstance()->getId();
$objItem->uuid = $objFile->uuid;
$objItem->pageID = $objPage->id;
$objItem->cid = $arrData['id'];
$objItem->type = $arrData['type'];
$objT = new \FrontendTemplate('watchlist_add_actions');
$objT->addHref = ampersand(\Controller::generateFrontendUrl($objPage->row()) . '?act=' . WATCHLIST_ACT_ADD . '&cid=' . $objItem->cid . '&type=' . $objItem->type . '&id=' . $strUuid . '&title=' . urlencode($objItem->getTitle()));
$objT->addTitle = $GLOBALS['TL_LANG']['WATCHLIST']['addTitle'];
$objT->addLink = $GLOBALS['TL_LANG']['WATCHLIST']['addLink'];
$objT->active = $objWatchlist->isInList($strUuid);
$objT->id = $strUuid;
return $objT->parse();
}
示例5: generateFilterBox
protected function generateFilterBox($filter)
{
$arrLinks = array();
$baseurl = $this->generateFrontendUrl($this->arrJump);
$objT = new \FrontendTemplate('mod_filterlink_set');
$objT->title = $GLOBALS['TL_LANG']['articlefilter']['selectedFilter'];
$objT->baseurl = $baseurl;
$objT->removeAll = $GLOBALS['TL_LANG']['articlefilter']['removeAll'];
if (!is_array($filter) || count($filter) == 0) {
return '';
}
foreach ($filter as $grp => $f) {
foreach ($f as $id) {
$arrAdd[] = sprintf('articlefilter_filter[%s][]=%s', $grp, $id);
$lbl[] = $this->getFilterTitle($id);
}
}
for ($x = 0; $x < count($arrAdd); $x++) {
$add = $arrAdd;
unset($add[$x]);
$arrLinks[] = ['href' => sprintf('%s?%s', $baseurl, implode('&', $add)), 'title' => $lbl[$x]];
}
$objT->links = $arrLinks;
return $objT->parse();
}
示例6: compile
protected function compile()
{
$GLOBALS['TL_JAVASCRIPT']['articlefilter'] = 'system/modules/articlefilter/assets/articlefilter.js';
$arrGroups = deserialize($this->articlefilter_groups);
$arrSelected = \Input::get('articlefilter_filter');
$res = $this->Database->prepare('SELECT * from tl_articlefilter_groups where id IN (' . implode(',', $arrGroups) . ') AND published = 1 ORDER BY FIELD(id, ' . implode(',', $arrGroups) . ')')->execute();
if ($res->numRows > 0) {
$arrBoxes = [];
$this->Template->hasGroups = true;
$id = 0;
while ($res->next()) {
$arrCriteria = $this->loadCriteriaByGroup($res->id);
if (is_array($arrCriteria)) {
$id++;
$objCB = new \FrontendTemplate($res->template);
$objCB->items = $arrCriteria;
$objCB->title = $res->title;
$objCB->name = $res->id;
$objCB->selected = $arrSelected[$res->id];
$objCB->id = $id;
$arrBoxes[] = $objCB->parse();
}
}
/* jumpTo Page */
$arrJump = $this->Database->prepare('SELECT id, alias from tl_page where id=?')->execute($this->jumpTo)->fetchAssoc();
$this->Template->criterias = implode("\n", $arrBoxes);
$this->Template->href = $this->generateFrontendUrl($arrJump);
$this->Template->lblSubmit = $GLOBALS['TL_LANG']['articlefilter']['lblSubmit'];
$this->Template->selectedMatchType = \Input::get('afstype') ? \Input::get('afstype') : $this->articlefilter_defaultfilter;
$this->Template->lblMatches = $GLOBALS['TL_LANG']['articlefilter']['lblMatches'];
$this->Template->lblAny = $GLOBALS['TL_LANG']['articlefilter']['lblAny'];
$this->Template->lblAll = $GLOBALS['TL_LANG']['articlefilter']['lblAll'];
}
}
示例7: parseCredit
protected function parseCredit($objItem)
{
global $objPage;
$objCredit = new FileCreditHybridModel();
$objCredit = $objCredit->findRelatedByCredit($objItem, $this->arrPids);
if (is_null($objCredit)) {
return null;
}
$objTemplate = new \FrontendTemplate('filecredit_default');
$objTemplate->setData($objCredit->file->row());
// TODO
$objTemplate->link = $this->generateCreditUrl($objCredit);
$objTemplate->linkText = $GLOBALS['TL_LANG']['MSC']['creditLinkText'];
// TODO
if ($objCredit->page === null && $objCredit->result->usage) {
$objTemplate->pageTitle = $objCredit->result->usage;
} else {
$objTemplate->pageTitle = $objCredit->page->pageTitle ? $objCredit->page->pageTitle : $objCredit->page->title;
}
// colorbox support
if ($objPage->outputFormat == 'xhtml') {
$strLightboxId = 'lightbox';
} else {
$strLightboxId = 'lightbox[' . substr(md5($objTemplate->getName() . '_' . $objCredit->file->id), 0, 6) . ']';
}
$objTemplate->attribute = $strLightboxId ? ($objPage->outputFormat == 'html5' ? ' data-gallery="#gallery-' . $this->id . '" data-lightbox="' : ' rel="') . $strLightboxId . '"' : '';
return $objTemplate->parse();
}
示例8: parseMap
public function parseMap()
{
$objT = new \FrontendTemplate($this->strTemplate);
$objT->setData($GLOBALS['TL_LANG']['imagemapster']);
$objT->active = $this->active;
return $objT->parse();
}
示例9: compile
protected function compile()
{
$strHtml = '';
$objTemplateTable = new \FrontendTemplate('hvv_tabelle');
if ($this->hvv_liga) {
$arrJson = json_decode(file_get_contents('http://service.mindbird.de/hvv-tabelle/www/' . $this->hvv_liga . '.json'), true);
$strHtmlTable = '';
foreach ($arrJson['table'] as $arrTeam) {
$objTemplate = new \FrontendTemplate('hvv_tabelle_zeile');
$objTemplate->position = $arrTeam['position'];
$objTemplate->team = $arrTeam['team'];
$objTemplate->games_count = $arrTeam['games']['count'];
$objTemplate->games_3031 = $arrTeam['games']['3031'];
$objTemplate->games_32 = $arrTeam['games']['32'];
$objTemplate->games_23 = $arrTeam['games']['23'];
$objTemplate->games_1303 = $arrTeam['games']['1303'];
$objTemplate->balls_positiv = $arrTeam['balls']['positiv'];
$objTemplate->balls_negativ = $arrTeam['balls']['negativ'];
$objTemplate->sets_positiv = $arrTeam['sets']['positiv'];
$objTemplate->sets_negativ = $arrTeam['sets']['negativ'];
$objTemplate->points = $arrTeam['points'];
if ($arrTeam['team'] == $this->hvv_mannschaft) {
$objTemplate->home_team = true;
}
$strHtmlTable .= $objTemplate->parse();
}
$objTemplateTable->strHtml = $strHtmlTable;
}
$this->Template->strHtml = $objTemplateTable->parse();
}
示例10: compile
/**
* Generate the module
*/
protected function compile()
{
$navTpl = new \FrontendTemplate($this->navigationTpl ?: 'nav_default');
$navTpl->level = 0;
$navTpl->items = $this->buildNavigationItems();
$this->Template->navigation = $navTpl->parse();
}
示例11: parseJs
protected function parseJs()
{
$objT = new \FrontendTemplate($this->strTemplate);
$objT->setData($this->arrData);
$objT->id = '#ctrl_' . $this->strName;
return $objT->parse();
}
示例12: parsePromoter
public function parsePromoter($objPromoter, $index = null, array $arrPromoters = array())
{
$strTemplate = $this->cal_promoterTemplate ? $this->cal_promoterTemplate : 'cal_promoter_default';
$objT = new \FrontendTemplate($strTemplate);
$objT->setData($objPromoter->row());
if ($objPromoter->room && ($objRoom = $objPromoter->getRelated('room')) !== null) {
$objT->room = $objRoom;
}
$contact = new \stdClass();
$hasContact = false;
if ($objPromoter->website) {
$objT->websiteUrl = \HeimrichHannot\Haste\Util\Url::addScheme($objPromoter->website);
}
foreach (static::$arrContact as $strField) {
if (!$objT->{$strField}) {
continue;
}
$hasContact = true;
$contact->{$strField} = $objT->{$strField};
}
$objT->hasContact = $hasContact;
$objT->contact = $contact;
$objT->contactTitle = $GLOBALS['TL_LANG']['cal_promoterlist']['contactTitle'];
$objT->phoneTitle = $GLOBALS['TL_LANG']['cal_promoterlist']['phoneTitle'];
$objT->faxTitle = $GLOBALS['TL_LANG']['cal_promoterlist']['faxTitle'];
$objT->emailTitle = $GLOBALS['TL_LANG']['cal_promoterlist']['emailTitle'];
$objT->websiteTitle = $GLOBALS['TL_LANG']['cal_promoterlist']['websiteTitle'];
if (!empty($arrPromoters) && $index !== null) {
$objT->cssClass = \HeimrichHannot\Haste\Util\Arrays::getListPositonCssClass($index, $arrPromoters);
}
return $objT->parse();
}
示例13: compile
/**
* Generate module
*/
protected function compile()
{
// Get ID
$strAlias = \Input::get('auto_item') ? \Input::get('auto_item') : \Input::get('store');
// Find published store from ID
if (($objStore = AnyStoresModel::findPublishedByIdOrAlias($strAlias)) !== null) {
// load all details
$objStore->loadDetails();
// generate description
$objDescription = \ContentModel::findPublishedByPidAndTable($objStore->id, $objStore->getTable());
if ($objDescription !== null) {
while ($objDescription->next()) {
$objStore->description .= \Controller::getContentElement($objDescription->current());
}
}
// Get referer for back button
$objStore->referer = $this->getReferer();
// generate google map if template and geodata is set
if ($this->anystores_mapTpl != '' && is_numeric($objStore->latitude) && is_numeric($objStore->longitude)) {
$objMapTemplate = new \FrontendTemplate($this->anystores_mapTpl);
$objMapTemplate->setData($objStore->row());
$objStore->gMap = $objMapTemplate->parse();
}
// Template
$objDetailTemplate = new \FrontendTemplate($this->anystores_detailTpl);
$objDetailTemplate->setData($objStore->row());
$this->Template->store = $objDetailTemplate->parse();
} else {
$this->_redirect404();
}
}
示例14: replaceInsertTags
public function replaceInsertTags($strTag)
{
if (strstr($strTag, 'bootstrapResponsiveYoutubeEmbed')) {
$arrPieces = explode('::', $strTag);
$n = [];
if (!strstr($arrPieces[1], '?')) {
$id = $arrPieces[1];
} else {
$m = explode('?', $arrPieces[1]);
$id = $m[0];
$n = explode('&', $m[1]);
}
if ($id == '') {
return false;
}
$objTemplate = new \FrontendTemplate('ce_bootstrap_youtube_responsive_embed');
$objTemplate->movieId = $id;
$objTemplate->playerType = intval($id) ? 'vimeo' : 'youtube';
$objTemplate->playerAspectRatio = 'embed-responsive-4by3';
foreach ($n as $prop) {
$pieces = explode('=', $prop);
$objTemplate->{$pieces[0]} = $pieces[1];
}
return $objTemplate->parse();
}
return false;
}
示例15: createShareButtons
public static function createShareButtons($networks, $theme = self::DEFAULT_THEME, $template = self::DEFAULT_TEMPLATE, $url = null, $title = null, $description = null, $image = null)
{
// access to page
global $objPage;
// try to deserialize
if (is_string($networks)) {
$networks = deserialize($networks);
}
// if there are no networks, don't do anything
if (!is_array($networks) || count($networks) == 0) {
return '';
}
// process theme
if ($theme == 'sharebuttons_none' || $theme == 'none' || !in_array($theme, array_keys($GLOBALS['sharebuttons']['themes']))) {
$theme = '';
}
// force theme to fontawesome if fontawesome template is used
if (stripos($template, 'fontawesome') !== false && $theme !== '' && $theme !== 'text') {
$theme = 'fontawesome';
} elseif ($theme == 'fontawesome') {
$template = 'sharebuttons_fontawesome';
}
// check for empty template
if (!$template) {
$template = self::DEFAULT_TEMPLATE;
}
// create share buttons template
$objButtonsTemplate = new \FrontendTemplate($template);
// assign enabled networks to template
foreach ($networks as $network) {
$objButtonsTemplate->{$network} = true;
}
// determine the share image (e.g. for pinterest)
if (!$image && isset($GLOBALS['SOCIAL_IMAGES']) && is_array($GLOBALS['SOCIAL_IMAGES']) && count($GLOBALS['SOCIAL_IMAGES']) > 0) {
$image = \Environment::get('base') . $GLOBALS['SOCIAL_IMAGES'][0];
}
// assign url, title, theme, image, description to template
$objButtonsTemplate->url = rawurlencode($url ?: \Environment::get('base') . \Environment::get('request'));
$objButtonsTemplate->title = rawurlencode(strip_tags($title ?: ($objPage->pageTitle ?: $objPage->title)));
$objButtonsTemplate->theme = $theme;
$objButtonsTemplate->image = rawurlencode($image);
$objButtonsTemplate->description = rawurlencode(strip_tags($description ?: $objPage->description));
// add translations to template
$translations = $GLOBALS['TL_LANG']['sharebuttons'];
$translations['mail_subject'] = rawurlencode($translations['mail_subject']);
$objButtonsTemplate->lang = $translations;
// insert CSS if necessary
if ($theme) {
$GLOBALS['TL_CSS'][] = 'system/modules/sharebuttons/assets/base.css||static';
$css_theme = $GLOBALS['sharebuttons']['themes'][$theme][1];
if (is_file(TL_ROOT . '/' . $css_theme)) {
$GLOBALS['TL_CSS'][] = $css_theme . '||static';
}
}
// insert javascript
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/sharebuttons/assets/scripts.js|static';
// return parsed template
return $objButtonsTemplate->parse();
}