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


PHP CTemplate::set方法代码示例

本文整理汇总了PHP中CTemplate::set方法的典型用法代码示例。如果您正苦于以下问题:PHP CTemplate::set方法的具体用法?PHP CTemplate::set怎么用?PHP CTemplate::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CTemplate的用法示例。


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

示例1: export

 function export($event)
 {
     CFactory::load('helpers', 'event');
     $handler = CEventHelper::getHandler($event);
     if (!$handler->showExport()) {
         echo JText::_('CC ACCESS FORBIDDEN');
         return;
     }
     header('Content-type: text/Calendar');
     header('Content-Disposition: attachment; filename="calendar.ics"');
     $creator = CFactory::getUser($event->creator);
     $offset = $creator->getUtcOffset();
     $date = new JDate($event->startdate);
     $dtstart = $date->toFormat('%Y%m%dT%H%M%S');
     $date = new JDate($event->enddate);
     $dtend = $date->toFormat('%Y%m%dT%H%M%S');
     $url = $handler->getFormattedLink('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id, false, true);
     $tmpl = new CTemplate();
     $tmpl->set('dtstart', $dtstart);
     $tmpl->set('dtend', $dtend);
     $tmpl->set('url', $url);
     $tmpl->set('event', $event);
     $raw = $tmpl->fetch('events.ical');
     unset($tmpl);
     echo $raw;
     exit;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:27,代码来源:view.raw.php

示例2: send

 /**
  * Do a batch send
  */
 function send($total = 100)
 {
     $mailqModel = CFactory::getModel('mailq');
     $userModel = CFactory::getModel('user');
     $mails = $mailqModel->get($total);
     $jconfig = JFactory::getConfig();
     $mailer = JFactory::getMailer();
     $config = CFactory::getConfig();
     $senderEmail = $jconfig->getValue('mailfrom');
     $senderName = $jconfig->getValue('fromname');
     if (empty($mails)) {
         return;
     }
     CFactory::load('helpers', 'string');
     foreach ($mails as $row) {
         // @rule: only send emails that is valid.
         // @rule: make sure recipient is not blocked!
         $userid = $userModel->getUserFromEmail($row->recipient);
         $user = CFactory::getUser($userid);
         if (!$user->isBlocked() && !JString::stristr($row->recipient, 'foo.bar')) {
             $mailer->setSender(array($senderEmail, $senderName));
             $mailer->addRecipient($row->recipient);
             $mailer->setSubject($row->subject);
             $tmpl = new CTemplate();
             $raw = isset($row->params) ? $row->params : '';
             $params = new JParameter($row->params);
             $base = $config->get('htmlemail') ? 'email.html' : 'email.text';
             if ($config->get('htmlemail')) {
                 $row->body = JString::str_ireplace(array("\r\n", "\r", "\n"), '<br />', $row->body);
                 $mailer->IsHTML(true);
             } else {
                 //@rule: Some content might contain 'html' tags. Strip them out since this mail should never contain html tags.
                 $row->body = CStringHelper::escape(strip_tags($row->body));
             }
             $tmpl->set('content', $row->body);
             $tmpl->set('template', rtrim(JURI::root(), '/') . '/components/com_community/templates/' . $config->get('template'));
             $tmpl->set('sitename', $config->get('sitename'));
             $row->body = $tmpl->fetch($base);
             // Replace any occurences of custom variables within the braces scoe { }
             if (!empty($row->body)) {
                 preg_match_all("/{(.*?)}/", $row->body, $matches, PREG_SET_ORDER);
                 foreach ($matches as $val) {
                     $replaceWith = $params->get($val[1], null);
                     //if the replacement start with 'index.php', we can CRoute it
                     if (strpos($replaceWith, 'index.php') === 0) {
                         $replaceWith = CRoute::getExternalURL($replaceWith);
                     }
                     if (!is_null($replaceWith)) {
                         $row->body = JString::str_ireplace($val[0], $replaceWith, $row->body);
                     }
                 }
             }
             unset($tmpl);
             $mailer->setBody($row->body);
             $mailer->send();
         }
         $mailqModel->markSent($row->id);
         $mailer->ClearAllRecipients();
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:63,代码来源:mailq.php

示例3: showGroupMiniHeader

 public function showGroupMiniHeader($groupId)
 {
     CMiniHeader::load();
     $option = JRequest::getVar('option', '', 'REQUEST');
     JFactory::getLanguage()->load('com_community');
     CFactory::load('models', 'groups');
     $group =& JTable::getInstance('Group', 'CTable');
     $group->load($groupId);
     $my = CFactory::getUser();
     // @rule: Test if the group is unpublished, don't display it at all.
     if (!$group->published) {
         return '';
     }
     if (!empty($group->id) && $group->id != 0) {
         $isMember = $group->isMember($my->id);
         $config = CFactory::getConfig();
         $tmpl = new CTemplate();
         $tmpl->set('my', $my);
         $tmpl->set('group', $group);
         $tmpl->set('isMember', $isMember);
         $tmpl->set('config', $config);
         $showMiniHeader = $option == 'com_community' ? $tmpl->fetch('groups.miniheader') : '<div id="community-wrap" style="min-height:50px;">' . $tmpl->fetch('groups.miniheader') . '</div>';
         return $showMiniHeader;
     }
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:25,代码来源:miniheader.php

示例4: renderElements

 /**
  * Renders the provided elements into their respective HTML formats.
  *
  * @param	Array	formElements	An array of CFormElement objects.
  * @param	string	position		The position of the field 'before' will be loaded before the rest of the form and 'after' will be loaded after the rest of the form loaded.
  *
  * returns	string	html			Contents of generated CFormElements.
  **/
 public static function renderElements($formElements, $position)
 {
     $tmpl = new CTemplate();
     $tmpl->set('formElements', $formElements);
     $tmpl->set('position', $position);
     $html = $tmpl->fetch('form.elements');
     return trim($html);
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:16,代码来源:formelement.php

示例5: getActivityContentHTML

 static function getActivityContentHTML($act)
 {
     // Ok, the activity could be an upload OR a wall comment. In the future, the content should
     // indicate which is which
     $html = '';
     $param = new JParameter($act->params);
     $action = $param->get('action', false);
     $photoid = $param->get('photoid', 0);
     CFactory::load('models', 'photos');
     $url = $param->get('url', false);
     CFactory::load('helpers', 'albums');
     if ($action == 'wall') {
         // unfortunately, wall post can also have 'photo' as its $act->apps. If the photo id is availble
         // for (newer activity stream, inside the param), we will show the photo snippet as well. Otherwise
         // just print out the wall content
         // Version 1.6 onwards, $params will contain photoid information
         // older version would have #photoid in the $title, since we link it to the photo
         $photoid = $param->get('photoid', false);
         if ($photoid) {
             $photo = JTable::getInstance('Photo', 'CTable');
             $photo->load($act->cid);
             $helper = new CAlbumsHelper($photo->albumid);
             if ($helper->showActivity()) {
                 $tmpl = new CTemplate();
                 $tmpl->set('url', $url);
                 $tmpl->set('photo', $photo);
                 $tmpl->set('param', $param);
                 $tmpl->set('act', $act);
                 return $tmpl->fetch('activity.photos.wall');
             }
         }
         return '';
     } elseif ($action == 'upload' && $photoid > 0) {
         $albumsHelper = new CAlbumsHelper($act->cid);
         if ($albumsHelper->isPublic()) {
             // If content has link to image, we could assume it is "upload photo" action
             // since old content add this automatically.
             // The $act->cid will be the album id, Retrive the recent photos uploaded
             // If $act->activities has data, that means this is an aggregated content
             // display some of them
             $photoModel = CFactory::getModel('photos');
             $album = JTable::getInstance('Album', 'CTable');
             $album->load($act->cid);
             if (empty($act->activities)) {
                 $acts[] = $act;
             } else {
                 $acts = $act->activities;
             }
             $tmpl = new CTemplate();
             $tmpl->set('album', $album);
             $tmpl->set('acts', $acts);
             return $tmpl->fetch('activity.photos.upload');
         }
     }
     return $html;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:56,代码来源:photos.php

示例6: getEventSummary

 static function getEventSummary($eventid, $param)
 {
     $model = CFactory::getModel('events');
     $event =& JTable::getInstance('Event', 'CTable');
     $event->load($eventid);
     $tmpl = new CTemplate();
     $tmpl->set('event', $event);
     $tmpl->set('param', $param);
     return $tmpl->fetch('activity.events.update');
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:10,代码来源:events.php

示例7: invite

 function invite()
 {
     CFactory::load('libraries', 'facebook');
     $facebook = new CFacebook();
     $config = CFactory::getConfig();
     $tmpl = new CTemplate();
     $tmpl->set('facebook', $facebook);
     $tmpl->set('config', $config);
     echo $tmpl->fetch('facebook.invite');
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:10,代码来源:view.html.php

示例8: showSwitcher

 public function showSwitcher()
 {
     $uri = JFactory::getURI();
     // Will see if there's a nicer solution to this
     $query = $uri->getQuery(true);
     unset($query['screen']);
     $query = $uri->buildQuery($query);
     $uri->setQuery($query);
     $uri = $uri->toString();
     // Build links
     $link = array('mobile' => $uri . '&screen=mobile', 'desktop' => $uri . '&screen=desktop');
     $tmpl = new CTemplate();
     $tmpl->set('link', $link);
     $tmpl->set('viewtype', JRequest::setVar('screen'));
     echo $tmpl->fetch('mobile.switcher');
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:16,代码来源:mobile.php

示例9: getActivityContentHTML

 static function getActivityContentHTML($act)
 {
     // Ok, the activity could be an upload OR a wall comment. In the future, the content should
     // indicate which is which
     $html = '';
     $param = new CParameter($act->params);
     $action = $param->get('action', false);
     $count = $param->get('count', false);
     $config = CFactory::getConfig();
     switch ($action) {
         case CAdminstreamsAction::TOP_USERS:
             $model = CFactory::getModel('user');
             $members = $model->getPopularMember($count);
             $html = '';
             //Get Template Page
             $tmpl = new CTemplate();
             $html = $tmpl->set('members', $members)->fetch('activity.members.popular');
             return $html;
             break;
         case CAdminstreamsAction::TOP_PHOTOS:
             $model = CFactory::getModel('photos');
             $photos = $model->getPopularPhotos($count, 0);
             $tmpl = new CTemplate();
             $html = $tmpl->set('photos', $photos)->fetch('activity.photos.popular');
             return $html;
             break;
         case CAdminstreamsAction::TOP_VIDEOS:
             $model = CFactory::getModel('videos');
             $videos = $model->getPopularVideos($count);
             $tmpl = new CTemplate();
             $html = $tmpl->set('videos', $videos)->fetch('activity.videos.popular');
             return $html;
             break;
     }
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:35,代码来源:adminstreams.php

示例10: onActivityContentDisplay

 function onActivityContentDisplay($args)
 {
     $model =& CFactory::getModel('Wall');
     $wall =& JTable::getInstance('Wall', 'CTable');
     $my = CFactory::getUser();
     if (empty($args->content)) {
         return '';
     }
     $wall->load($args->cid);
     CFactory::load('libraries', 'privacy');
     CFactory::load('libraries', 'comment');
     $comment = CComment::stripCommentData($wall->comment);
     $config = CFactory::getConfig();
     $commentcut = false;
     if (strlen($comment) > $config->getInt('streamcontentlength')) {
         $origcomment = $comment;
         $comment = JString::substr($comment, 0, $config->getInt('streamcontentlength')) . ' ...';
         $commentcut = true;
     }
     if (CPrivacy::isAccessAllowed($my->id, $args->target, 'user', 'privacyProfileView')) {
         CFactory::load('helpers', 'videos');
         CFactory::load('libraries', 'videos');
         CFactory::load('libraries', 'wall');
         $videoContent = '';
         $params = new CParameter($args->params);
         $videoLink = $params->get('videolink');
         $image = $params->get('url');
         // For older activities that does not have videoLink , we need to process it the old way.
         if (!$videoLink) {
             $html = CWallLibrary::_processWallContent($comment);
             $tmpl = new CTemplate();
             $html = CStringHelper::escape($html);
             if ($commentcut) {
                 //add read more/less link for content
                 $html .= '<br /><br /><a href="javascript:void(0)" onclick="jQuery(\'#shortcomment_' . $args->cid . '\').hide(); jQuery(\'#origcomment_' . $args->cid . '\').show();" >' . JText::_('COM_COMMUNITY_READ_MORE') . '</a>';
                 $html = '<div id="shortcomment_' . $args->cid . '">' . $html . '</div>';
                 $html .= '<div id="origcomment_' . $args->cid . '" style="display:none;">' . $origcomment . '<br /><br /><a href="javascript:void(0);" onclick="jQuery(\'#shortcomment_' . $args->cid . '\').show(); jQuery(\'#origcomment_' . $args->cid . '\').hide();" >' . JText::_('COM_COMMUNITY_READ_LESS') . '</a></div>';
             }
             $tmpl->set('comment', $html);
             $html = $tmpl->fetch('activity.wall.post');
         } else {
             $html = '<ul class ="cDetailList clrfix">';
             $html .= '<li>';
             $image = !$image ? rtrim(JURI::root(), '/') . '/components/com_community/assets/playvideo.gif' : $image;
             $videoLib = new CVideoLibrary();
             $provider = $videoLib->getProvider($videoLink);
             $html .= '<!-- avatar --><div class="avatarWrap"><a href="javascript:void(0);" onclick="joms.activities.showVideo(\'' . $args->id . '\');"><img width="64" src="' . $image . '" class="cAvatar"/></a></div><!-- avatar -->';
             $videoPlayer = $provider->getViewHTML($provider->getId(), '300', '300');
             $comment = CString::str_ireplace($videoLink, '', $comment);
             $html .= '<!-- details --><div class="detailWrap alpha">' . $comment . '</div><!-- details -->';
             if (!empty($videoPlayer)) {
                 $html .= '<div style="display: none;clear: both;padding-top: 5px;" class="video-object">' . $videoPlayer . '</div>';
             }
             $html .= '</li>';
             $html .= '</ul>';
         }
         return $html;
     }
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:59,代码来源:walls.php

示例11: getItemsHTML

 /**
  *
  * @param string $tag the tag to seach for
  * @return string HTML code of item listing
  */
 public function getItemsHTML($tag)
 {
     $items = $this->getItems($tag);
     $tmpl = new CTemplate();
     $tmpl->set('items', $items);
     $html = $tmpl->fetch('tag.list');
     return $html;
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:13,代码来源:tags.php

示例12: ajaxInvite

 public function ajaxInvite()
 {
     CFactory::load('libraries', 'facebook');
     $facebook = new CFacebook();
     $config = CFactory::getConfig();
     $tmpl = new CTemplate();
     echo $tmpl->set('facebook', $facebook)->set('config', $config)->set('sitename', $config->get('sitename'))->fetch('facebook.inviteframe');
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:8,代码来源:view.html.php

示例13: getHTML

 public static function getHTML($url, $sortItems = array(), $defaultSort = '', $filterItems = array(), $defaultFilter = '')
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $cleanURL = $url;
     $uri = JFactory::getURI();
     $queries = $_REQUEST;
     $allow = array('option', 'view', 'browse', 'task');
     foreach ($queries as $key => $value) {
         if (!in_array($key, $allow)) {
             unset($queries[$key]);
         }
     }
     $selectedSort = $jinput->get->get('sort', $defaultSort, 'STRING');
     $selectedFilter = $jinput->get->get('filter', $defaultFilter, 'STRING');
     $tmpl = new CTemplate();
     $tmpl->set('queries', $queries);
     $tmpl->set('selectedSort', $selectedSort);
     $tmpl->set('selectedFilter', $selectedFilter);
     $tmpl->set('sortItems', $sortItems);
     $tmpl->set('uri', $uri);
     $tmpl->set('filterItems', $filterItems);
     $tmpl->set('jinput', $jinput);
     return $tmpl->fetch('filterbar.html');
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:25,代码来源:filterbar.php

示例14: getHTML

 function getHTML()
 {
     $config = CFactory::getConfig();
     if ($config->get('enablesharethis')) {
         $tmpl = new CTemplate();
         $tmpl->set('uri', $this->currentURI);
         return $tmpl->fetch('bookmarks');
     } else {
         return '';
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:11,代码来源:bookmarks.php

示例15: getHTML

 public function getHTML($url, $sortItems = array(), $defaultSort = '', $filterItems = array(), $defaultFilter = '')
 {
     $cleanURL = $url;
     $uri =& JFactory::getURI();
     $queries = JRequest::get('GET');
     // If there is Itemid in the querystring, we need to unset it so that CRoute
     // will generate it's correct Itemid
     if (isset($queries['Itemid'])) {
         unset($queries['Itemid']);
     }
     // Force link to start with first page
     if (isset($queries['limitstart'])) {
         unset($queries['limitstart']);
     }
     if (isset($queries['start'])) {
         unset($queries['start']);
     }
     $selectedSort = JRequest::getVar('sort', $defaultSort, 'GET');
     $selectedFilter = JRequest::getVar('filter', $defaultFilter, 'GET');
     $tmpl = new CTemplate();
     $tmpl->set('queries', $queries);
     $tmpl->set('selectedSort', $selectedSort);
     $tmpl->set('selectedFilter', $selectedFilter);
     $tmpl->set('sortItems', $sortItems);
     $tmpl->set('uri', $uri);
     $tmpl->set('filterItems', $filterItems);
     return $tmpl->fetch('filterbar.html');
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:28,代码来源:filterbar.php


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