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


PHP ContentHelperRoute::getArticleRoute方法代码示例

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


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

示例1: getRelatedAsHtml

 /**
  * @param $id
  * @param $tags
  * @return string
  */
 public function getRelatedAsHtml($id, $catid, $access, $tags)
 {
     $count = CedTagsHelper::param('RelatedArticlesCountByTags', 10);
     $relatedArticlesTitle = CedTagsHelper::param('RelatedArticlesTitleByTags', "Related Articles");
     //$max=max(intval($relatedArticlesCount),array_count_values($termIds));
     //find the unique article ids
     $contentIds = $this->getUniqueArticleId($tags, $id);
     $html = "";
     if (is_array($contentIds) && sizeof($contentIds) > 0) {
         $rows = $this->getModel($contentIds, $count);
         if (empty($rows)) {
             return '';
         }
         $user = JFactory::getUser();
         $aid = JVERSION < 1.6 ? $user->get('aid', 0) : max($user->getAuthorisedViewLevels());
         $html = '<div class="relateditemsbytags">' . $relatedArticlesTitle . '</div>
                     <div>
                     <ul class="relateditems">';
         foreach ($rows as $row) {
             if ($row->access <= $aid) {
                 $link = JVERSION < 1.6 ? JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid)) : JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug));
             } else {
                 $link = JRoute::_('index.php?option=com_user&view=login');
             }
             $html .= '<li> <a href="' . $link . '">' . htmlspecialchars($row->title) . '</a></li>';
         }
         $html .= '</ul></div>';
     }
     return $html;
 }
开发者ID:lautarodragan,项目名称:ideary,代码行数:35,代码来源:joomla.php

示例2: getRelatedItemsJumpList

function getRelatedItemsJumpList()
{
    $cids = func_get_args();
    $groups = count($cids) > 1 ? true : false;
    $list = '<select class="relatedtech" name="data[related][]" onchange="window.location=this.value;return false;">' . "\n";
    $list .= '<option value="" selection="selected">Velg...</option>' . "\n";
    foreach ($cids as $catID) {
        if (!is_numeric($catID)) {
            continue;
        }
        $db =& JFactory::getDBO();
        $sql = "SELECT c.id, c.title, c.catid, c.sectionid, cat.title AS cat_title FROM #__content c " . "LEFT JOIN #__categories cat ON c.catid = cat.id " . "WHERE catid='{$catID}' AND c.state > 0 ORDER BY title";
        $db->setQuery($sql);
        $items = $db->loadObjectList();
        if ($groups && count($items) > 1) {
            $list .= '<optgroup label="' . $items[0]->cat_title . '">' . "\n";
        }
        require_once JPATH_SITE . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'route.php';
        foreach ($items as $item) {
            $listinglink = ContentHelperRoute::getArticleRoute($item->id, $item->catid, $item->sectionid);
            $list .= '<option value="' . $listinglink . '">' . $item->title . '</option>' . "\n";
        }
        if ($groups && count($items) > 1) {
            $list .= '</optgroup>' . "\n";
        }
    }
    $list .= '</select>' . "\n";
    return $list;
}
开发者ID:bizanto,项目名称:Hooked,代码行数:29,代码来源:related_items.php

示例3: getArticle

 /**
  *  Funkce pro načtení dat 1 článku z databáze
  */
 function getArticle($articleId, $text = 'all', $skipPlugins = false)
 {
     $db =& JFactory::getDBO();
     $db->setQuery("SELECT * FROM #__content WHERE id='{$articleId}' LIMIT 1;");
     $rows = $db->loadObjectList();
     if (count($rows) == 1) {
         $article = $rows[0]->introtext . $rows[0]->fulltext;
     } else {
         return false;
     }
     //připravíme text
     if ($text == 'introtext') {
         $rows[0]->text = $rows[0]->introtext;
     } elseif ($text == 'fulltext') {
         $rows[0]->text = $rows[0]->fulltext;
     } else {
         $rows[0]->text = $rows[0]->introtext . $rows[0]->fulltext;
     }
     if (!$skipPlugins) {
         $dispatcher =& JDispatcher::getInstance();
         JPluginHelper::importPlugin("content");
         //naimportujeme všechny pluginy pro zpracování obsahu
         $rows[0]->parameters = new JParameter($rows[0]->attribs);
         //vytvoříme objekt s parametry článku
         $results = $dispatcher->trigger('onPrepareContent', array(&$rows[0], &$rows[0]->parameters, 0));
         //načtení pluginů
     }
     //doplnime uri na clanek
     $rows[0]->uri = JRoute::_(JURI::root() . ContentHelperRoute::getArticleRoute($rows[0]->id), true, -1);
     return $rows[0];
 }
开发者ID:KIZI,项目名称:sewebar-cms,代码行数:34,代码来源:documents.php

示例4: getContent

 /**
  * Generate content
  * @param   object      The article object.  Note $article->text is also available
  * @param   object      The article params
  * @param   boolean     Modules context
  * @return  string      Returns html code or empty string.
  */
 private function getContent(&$article, &$params, $moduleContext = false)
 {
     $doc = JFactory::getDocument();
     /* @var $doc JDocumentHtml */
     $doc->addStyleSheet(JURI::root() . "plugins/content/fastsocialshare/style/style.css");
     $uriInstance = JURI::getInstance();
     if (!$moduleContext) {
         if (!class_exists('ContentHelperRoute')) {
             include_once JPATH_SITE . '/components/com_content/helpers/route.php';
         }
         $url = JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catslug), false);
         $root = rtrim($uriInstance->getScheme() . '://' . $uriInstance->getHost(), '/');
         $url = $root . $url;
         $title = htmlentities($article->title, ENT_QUOTES, "UTF-8");
     } else {
         $url = JURI::current();
         $title = htmlentities($doc->title, ENT_QUOTES, "UTF-8");
     }
     $html = $this->getFacebookLike($this->params, $url, $title);
     $html .= $this->getFacebookShareMe($this->params, $url, $title);
     $html .= $this->getTwitter($this->params, $url, $title);
     $html .= $this->getGooglePlusOne($this->params, $url, $title);
     $html .= $this->getLinkedIn($this->params, $url, $title);
     $html .= $this->getPinterest($this->params, $url, $title);
     return '<div class="fastsocialshare_container">' . $html . '<div class="fastsocialshare_clearer"></div></div>';
 }
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:33,代码来源:fastsocialshare.php

示例5: display

 function display()
 {
     $app = JFactory::getApplication();
     $doc =& JFactory::getDocument();
     $params =& $app->getParams();
     // Get some data from the model
     JRequest::setVar('limit', $app->getCfg('feed_limit'));
     $category =& $this->get('Category');
     $rows =& $this->get('Data');
     $doc->link = JRoute::_(ContentHelperRoute::getCategoryRoute($category->id, $cagtegory->sectionid));
     foreach ($rows as $row) {
         // strip html from feed item title
         $title = $this->escape($row->title);
         $title = html_entity_decode($title);
         // url link to article
         // & used instead of &amp; as this is converted by feed creator
         $link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid));
         // strip html from feed item description text
         // TODO: Only pull fulltext if necessary (actually, just get the necessary fields).
         $description = $params->get('feed_summary', 0) ? $row->introtext : $row->introtext;
         $author = $row->created_by_alias ? $row->created_by_alias : $row->author;
         @($date = $row->created ? date('r', strtotime($row->created)) : '');
         // load individual item creator class
         $item = new JFeedItem();
         $item->title = $title;
         $item->link = $link;
         $item->description = $description;
         $item->date = $date;
         $item->category = $row->category;
         // loads item info into rss array
         $doc->addItem($item);
     }
 }
开发者ID:joebushi,项目名称:joomla,代码行数:33,代码来源:view.feed.php

示例6: _getList

		protected function _getList($params, $module){
			$this->params = $params;
			$list = array();
			$source_category = $params->get('source');
			
			$items = $this->getCategoryItems($source_category, $params);	
			
			if(!empty($items)) {
				include_once JPATH_SITE . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'route.php';											
				$custom = $this->_getCustomUrl($params);
				foreach($items as $key => $item){
					$category = $this->getCategory($item->catid);
					$item->catitle = $category->title;
					if(!$this->getItemImage($item)){
						$item->image = 'modules/'.Ytools::getModule()->module . '/assets/images/nophoto.png';
					}
					if(array_key_exists($item->id, $custom)){
						$item->link=  trim($custom[$item->id]->url);
					}else{						
						$item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->id, $item->catid));
					}												
						$item->description = strip_tags($item->introtext);
				}
			}	
			return $items;
		}
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:26,代码来源:helper.php

示例7: display

 function display()
 {
     global $mainframe;
     // parameters
     $app = JFactory::getApplication();
     $db = JFactory::getDbo();
     $document = JFactory::getDocument();
     $params = $app->getParams();
     $feedEmail = @$app->getCfg('feed_email') ? $app->getCfg('feed_email') : 'author';
     $siteEmail = $app->getCfg('mailfrom');
     // Get some data from the model
     JRequest::setVar('limit', $app->getCfg('feed_limit'));
     $article =& $this->get('Article');
     $rows =& $this->get('Data');
     $document->link = JRoute::_(ContentHelperRoute::getArticleRoute($article->id, $article->catid));
     foreach ($rows as $row) {
         // strip html from feed item title
         $title = $this->escape($row->title);
         $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
         // url link to article
         // & used instead of &amp; as this is converted by feed creator
         $link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid));
         // strip html from feed item description text
         $description = $params->get('feed_summary', 0) ? $row->introtext . $row->fulltext : $row->introtext;
         $author = $row->created_by_alias ? $row->created_by_alias : $row->author;
         // load individual item creator class
         $item = new JFeedItem();
         $item->title = $title;
         $item->link = $link;
         $item->description = $description;
         $item->date = $row->created;
         // loads item info into rss array
         $document->addItem($item);
     }
 }
开发者ID:xenten,项目名称:swift-kanban,代码行数:35,代码来源:view.feed.php

示例8: getList

 function getList()
 {
     ///var_dump ($this->id);
     global $mainframe;
     JPluginHelper::importPlugin('content');
     $dispatcher =& JDispatcher::getInstance();
     $params =& JComponentHelper::getParams('com_content');
     $limitstart = $this->limit;
     $rows = $this->getDataFromCate();
     if (count($rows) > 0) {
         for ($i = 0; $i < count($rows); $i++) {
             $rows[$i]['text'] = $rows[$i]['introtext'];
             $results = $dispatcher->trigger('onPrepareContent', array(&$rows[$i], &$params, $limitstart));
             $items[$i]['introtext'] = $rows[$i]['text'];
             $items[$i]['id'] = $rows[$i]['id'];
             $items[$i]['img'] = $this->getImage($rows[$i]['text']);
             $items[$i]['title'] = $rows[$i]['title'];
             $items[$i]['content'] = $this->removeImage($rows[$i]['text']);
             $link = JRoute::_(ContentHelperRoute::getArticleRoute($rows[$i]['slug'], $rows[$i]['catslug'], $rows[$i]['sectionid']));
             $items[$i]['link'] = $link;
         }
     }
     $items = $this->update($items);
     /*   Process Images*/
     return $items;
 }
开发者ID:naquib555,项目名称:quBitolgy,代码行数:26,代码来源:contentslider.php

示例9: _prepareItem

 /**
  * 
  * @param object $item
  * @return object
  */
 protected function _prepareItem($item)
 {
     $item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug));
     $item->introtext = JHtml::_('string.truncate', $item->introtext, $this->_params->get('intro_length', 200));
     $item->cat_link = JRoute::_(ContentHelperRoute::getCategoryRoute($item->catid));
     return $item;
 }
开发者ID:jooservices,项目名称:zt-news,代码行数:12,代码来源:content.php

示例10: renderItem

 function renderItem(&$item, &$params, &$access)
 {
     global $mainframe;
     $user =& JFactory::getUser();
     $item->text = $item->introtext;
     $item->groups = '';
     $item->readmore = trim($item->fulltext) != '';
     $item->metadesc = '';
     $item->metakey = '';
     $item->created = '';
     $item->modified = '';
     if ($params->get('readmore') || $params->get('link_titles')) {
         if ($params->get('intro_only')) {
             // Check to see if the user has access to view the full article
             if ($item->access <= $user->get('aid', 0)) {
                 $itemparams = new JParameter($item->attribs);
                 $readmoretxt = $itemparams->get('readmore', JText::_('Read more text'));
                 $item->linkOn = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->sectionid));
                 $item->linkText = $readmoretxt;
             } else {
                 $item->linkOn = JRoute::_('index.php?option=com_user&view=login');
                 $item->linkText = JText::_('Login To Read More');
             }
         }
     }
     if (!$params->get('image')) {
         $item->text = preg_replace('/<img[^>]*>/', '', $item->text);
     }
     $results = $mainframe->triggerEvent('onAfterDisplayTitle', array(&$item, &$params, 1));
     $item->afterDisplayTitle = trim(implode("\n", $results));
     $results = $mainframe->triggerEvent('onBeforeDisplayContent', array(&$item, &$params, 1));
     $item->beforeDisplayContent = trim(implode("\n", $results));
     require JModuleHelper::getLayoutPath('mod_newsflash', '_item');
 }
开发者ID:RangerWalt,项目名称:ecci,代码行数:34,代码来源:helper.php

示例11: renderItem

 function renderItem(&$item, &$params, &$access)
 {
     global $mainframe;
     $user =& JFactory::getUser();
     $item->text = $item->introtext;
     $item->groups = '';
     $item->readmore = trim($item->fulltext) != '';
     $item->metadesc = '';
     $item->metakey = '';
     $item->access = '';
     $item->created = '';
     $item->modified = '';
     if ($params->get('readmore') || $params->get('link_titles')) {
         if ($params->get('intro_only')) {
             // Check to see if the user has access to view the full article
             if ($item->access <= $user->get('aid', 0)) {
                 $linkOn = ContentHelperRoute::getArticleRoute($item->slug, $item->catslug);
             } else {
                 $linkOn = JRoute::_('index.php?option=com_user&task=register');
             }
         }
         $item->linkOn = $linkOn;
     }
     $results = $mainframe->triggerEvent('onAfterDisplayTitle', array(&$item, &$params, 1));
     $item->afterDisplayTitle = trim(implode("\n", $results));
     $results = $mainframe->triggerEvent('onBeforeDisplayContent', array(&$item, &$params, 1));
     $item->beforeDisplayContent = trim(implode("\n", $results));
     require JModuleHelper::getLayoutPath('mod_yoo_drawer', '_item');
 }
开发者ID:janssit,项目名称:www.kadulleke.be,代码行数:29,代码来源:helper.php

示例12: format

 private function format(&$articles, $params)
 {
     if (!$articles) {
         return;
     }
     foreach ($articles as $article) {
         $category = JTable::getInstance('Category');
         $category->load($article->catid);
         $article->category = $category;
         $article->permalink = ContentHelperRoute::getArticleRoute($article->id . ':' . $article->alias, $article->catid);
         $article->permalink = JRoute::_($article->permalink);
         $article->category->permalink = ContentHelperRoute::getCategoryRoute($category->id . ':' . $category->alias);
         $article->category->permalink = JRoute::_($article->category->permalink);
         $article->content = empty($article->introtext) ? $article->fulltext : $article->introtext;
         $titleLength = $params->get('title_length');
         $contentLength = $params->get('content_length');
         if ($titleLength) {
             $article->title = JString::substr($article->title, 0, $titleLength);
         }
         // Try to get image of the article
         $image = $this->processContentImage($article->content);
         if ($image) {
             $article->image = $image;
         }
         if ($contentLength) {
             $article->content = JString::substr(strip_tags($article->content), 0, $contentLength) . ' ...';
         } else {
             $base = JURI::base(true) . '/';
             $protocols = '[a-zA-Z0-9]+:';
             //To check for all unknown protocals (a protocol must contain at least one alpahnumeric fillowed by :
             $regex = '#(src|href|poster)="(?!/|' . $protocols . '|\\#|\')([^"]*)"#m';
             $article->content = preg_replace($regex, "\$1=\"{$base}\$2\"", $article->content);
         }
     }
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:35,代码来源:view.html.php

示例13: go

 public function go()
 {
     $url = JRequest::getVar('url');
     $id = JRequest::getVar('id');
     if ($url == 'category') {
         $link = 'index.php?option=com_content&view=category&id=' . $id;
         //find item id
         $needles = array('category' => array($id));
         if ($item = self::_findItem($needles)) {
             $link .= '&Itemid=' . $item;
         } elseif ($item = self::_findItem()) {
             $link .= '&Itemid=' . $item;
         }
         $start = JRequest::getVar('start', null);
         if ($start) {
             $link .= '&start=' . $start;
         }
     } else {
         //find category id via article id
         $model = $this->getModel('Url', 'TTOL_HomeModel');
         $article = $model->getArticle($id);
         require_once JPATH_SITE . '/components/com_content/helpers/route.php';
         $article->slug = $article->id . ':' . $article->alias;
         $article->catslug = $article->catid ? $article->catid . ':' . $article->category_alias : $article->catid;
         $link = ContentHelperRoute::getArticleRoute($article->slug, $article->catslug);
     }
     $this->setRedirect(JRoute::_($link));
     return true;
 }
开发者ID:ngxuanmui,项目名称:thongtinonline.net,代码行数:29,代码来源:url.php

示例14: getActionForm

 public function getActionForm($formAction, $formData, &$return)
 {
     switch ($formAction) {
         case 1:
             $return->actionForm = "url";
             $return->actionFormData = $formData;
             break;
         case 2:
             $this->_db->setQuery($this->_db->getQuery(true)->select('link')->from("#__menu")->where("id = " . (int) $formData));
             $menuItem = $this->_db->loadObject();
             $return->actionForm = "url";
             $return->actionFormData = isset($menuItem->link) ? $menuItem->link : '';
             break;
         case 3:
             require_once JPATH_SITE . '/components/com_content/helpers/route.php';
             $this->_db->setQuery($this->_db->getQuery(true)->select('a.catid,CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug')->from("#__content AS a")->join("LEFT", "#__categories AS cc ON a.catid = cc.id")->where('a.id = ' . (int) $formData));
             $article = $this->_db->loadObject();
             $return->actionForm = "url";
             $return->actionFormData = JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catid));
             break;
         case 4:
             $return->actionForm = "message";
             $return->actionFormData = $formData;
             break;
     }
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:26,代码来源:paymentgateway.php

示例15: getData

    function getData($ids)
    {
        // prepare an array
        $results = array();
        // prepare an query part
        $query_ids = implode(',', $ids);
        // generate the query
        $database = JFactory::getDBO();
        // SQL query for slides
        $query = '
		SELECT 
			`c`.`id` AS `id`,
			`c`.`catid` AS `cid`,
			`c`.`title` AS `title`
		FROM 
			#__content AS `c` 
		WHERE 
			`c`.`id` IN (' . $query_ids . ')
		;';
        // running query
        $database->setQuery($query);
        // if results exists
        if ($datas = $database->loadObjectList()) {
            // parsing data
            foreach ($datas as $item) {
                // array with prepared image
                $results[$item->id] = array('id' => $item->id, 'cid' => $item->cid, 'title' => stripslashes($item->title), 'link' => JRoute::_(ContentHelperRoute::getArticleRoute($item->id, $item->cid)));
            }
        }
        // return the results
        return $results;
    }
开发者ID:paisit,项目名称:pyzid,代码行数:32,代码来源:model.php


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