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


PHP CTemplate类代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例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: 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

示例9: 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

示例10: 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

示例11: export

 public function export($event)
 {
     //CFactory::load( 'helpers' , 'event' );
     $handler = CEventHelper::getHandler($event);
     if (!$handler->showExport()) {
         echo JText::_('COM_COMMUNITY_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->format('Ymd\\THis');
     //$date->format('%Y%m%dT%H%M%S');
     $date = new JDate($event->enddate);
     $dtend = $date->format('Ymd\\THis');
     //$date->format('%Y%m%dT%H%M%S');
     $date = new JDate($event->repeatend);
     $rend = $date->format('Ymd\\THis');
     //$date->format('%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('rend', $rend);
     $tmpl->set('url', $url);
     $tmpl->set('event', $event);
     $raw = $tmpl->fetch('events.ical');
     unset($tmpl);
     echo $raw;
     exit;
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:33,代码来源:view.raw.php

示例12: 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

示例13: getHTML

 public static function getHTML($nameAttribute, $selectedAccess = 0, $buttonType = COMMUNITY_PRIVACY_BUTTON_SMALL, $access = array(), $type = '')
 {
     $template = new CTemplate();
     $config = CFactory::getConfig();
     // Initialize default options to show
     if (empty($access)) {
         $access['public'] = true;
         $access['members'] = true;
         $access['friends'] = true;
         $access['self'] = true;
     }
     $classAttribute = $buttonType == COMMUNITY_PRIVACY_BUTTON_SMALL ? 'js_PriContainer' : 'js_PriContainer js_PriContainerLarge';
     return $template->set('classAttribute', $classAttribute)->set('access', $access)->set('nameAttribute', $nameAttribute)->set('selectedAccess', $selectedAccess)->set('type', $type)->fetch('privacy');
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:14,代码来源:privacy.php

示例14: 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

示例15: ajaxIphoneFriends

 public function ajaxIphoneFriends()
 {
     $objResponse = new JAXResponse();
     $document = JFactory::getDocument();
     $viewType = $document->getType();
     $view =& $this->getView('friends', '', $viewType);
     $html = '';
     ob_start();
     $this->display();
     $content = ob_get_contents();
     ob_end_clean();
     $tmpl = new CTemplate();
     $tmpl->set('toolbar_active', 'friends');
     $simpleToolbar = $tmpl->fetch('toolbar.simple');
     $objResponse->addAssign('social-content', 'innerHTML', $simpleToolbar . $content);
     return $objResponse->sendResponse();
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:17,代码来源:friends.php


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