当前位置: 首页>>代码示例>>PHP>>正文


PHP FrontendTemplate类代码示例

本文整理汇总了PHP中FrontendTemplate的典型用法代码示例。如果您正苦于以下问题:PHP FrontendTemplate类的具体用法?PHP FrontendTemplate怎么用?PHP FrontendTemplate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FrontendTemplate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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();
 }
开发者ID:codefog,项目名称:contao-disqus,代码行数:13,代码来源:Disqus.php

示例2: 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;
 }
开发者ID:fritzmg,项目名称:contao-facebook-js-sdk,代码行数:32,代码来源:FacebookJSSDK.php

示例3: 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();
 }
开发者ID:heimrichhannot,项目名称:contao-watchlist,代码行数:25,代码来源:WatchlistItemEnclosure.php

示例4: 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();
 }
开发者ID:kozi,项目名称:contao-articlefilter,代码行数:25,代码来源:ModuleFilterLinks.php

示例5: 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'];
     }
 }
开发者ID:kozi,项目名称:contao-articlefilter,代码行数:34,代码来源:ModuleFilterForm.php

示例6: __construct

 public function __construct()
 {
     // if the application wasn't defined before we will define it
     if (!defined('NAMED_APPLICATION')) {
         define('NAMED_APPLICATION', 'frontend');
     }
     // set the module
     $this->setModule(SpoonFilter::getGetValue('module', null, ''));
     // set the requested file
     $this->setFile(SpoonFilter::getGetValue('file', null, ''));
     // set the language
     $this->setLanguage(SpoonFilter::getGetValue('language', FrontendLanguage::getActiveLanguages(), SITE_DEFAULT_LANGUAGE));
     // create a new template instance (this will handle all stuff for us)
     $tpl = new FrontendTemplate();
     // enable addslashes on each locale
     $tpl->setAddSlashes(true);
     // set correct headers
     SpoonHTTP::setHeaders('content-type: application/javascript');
     // fetch the template path
     if ($this->module == 'core') {
         $file = FRONTEND_CORE_PATH . '/js/' . $this->getFile();
     } else {
         $file = FRONTEND_MODULES_PATH . '/' . $this->getModule() . '/js/' . $this->getFile();
     }
     // output the template
     $tpl->display(FrontendTheme::getPath($file), true);
 }
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:27,代码来源:javascript.php

示例7: 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;
 }
开发者ID:codefog,项目名称:contao-cookiebar,代码行数:34,代码来源:CookieBar.php

示例8: 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();
 }
开发者ID:pandroid,项目名称:contao-filecredits,代码行数:28,代码来源:FileCredit.php

示例9: 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();
     }
 }
开发者ID:stefansl,项目名称:anyStores,代码行数:34,代码来源:ModuleAnyStoresDetails.php

示例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();
 }
开发者ID:terminal42,项目名称:contao-mp_forms,代码行数:10,代码来源:MPFormsStepsModule.php

示例11: parseMap

 public function parseMap()
 {
     $objT = new \FrontendTemplate($this->strTemplate);
     $objT->setData($GLOBALS['TL_LANG']['imagemapster']);
     $objT->active = $this->active;
     return $objT->parse();
 }
开发者ID:heimrichhannot,项目名称:contao-imagemapster,代码行数:7,代码来源:ImageMapster.php

示例12: 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();
 }
开发者ID:mindbird,项目名称:contao-hvv-tabelle,代码行数:30,代码来源:HVVTabelle.php

示例13: parseJs

 protected function parseJs()
 {
     $objT = new \FrontendTemplate($this->strTemplate);
     $objT->setData($this->arrData);
     $objT->id = '#ctrl_' . $this->strName;
     return $objT->parse();
 }
开发者ID:heimrichhannot,项目名称:contao-dropzone,代码行数:7,代码来源:DropZone.php

示例14: 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();
 }
开发者ID:heimrichhannot,项目名称:contao-calendar_plus,代码行数:32,代码来源:PromoterController.php

示例15: 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;
 }
开发者ID:markocupic,项目名称:bootstrap_responsive_youtube_embed,代码行数:27,代码来源:ReplaceInsertTags.php


注:本文中的FrontendTemplate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。