Новости Joomla

0 Пользователей и 1 Гость просматривают эту тему.
  • 32 Ответов
  • 5552 Просмотров
*

beagler

  • Живу я здесь
  • 3276
  • 392 / 4
  • https://alorisman.ru/
Re: Нет навигации по страницам
« Ответ #31 : 02.01.2011, 00:13:22 »
никак не получилось поймать баг.

Вышел из положения проще - в item.php шаблона добавляем
Код
<?php 
$html = '';
global $mainframe;
$db = & JFactory::getDBO();
$user = & JFactory::getUser();
$uid = $this->item->id;
                $config = & JFactory::getConfig();





// Determine sort order
//a.created
//a.hits
//a.ordering
//f.ordering
$orderby = 'a.title';




$query = 'SELECT a.id,a.title,a.introtext,'
. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'
. ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug'
. ' FROM #__content AS a'
. ' LEFT JOIN #__categories AS cc ON cc.id = a.catid'
. ' WHERE a.catid = ' . (int) $this->item->catid
. ' AND a.access <= ' .(int) $user->get('aid', 0)
. ' ORDER BY '. $orderby;


$db->setQuery($query);
$list = $db->loadObjectList('id');


// this check needed if incorrect Itemid is given resulting in an incorrect result

if ( !is_array($list) ) {
$list = array();
}

reset($list);


// location of current content item in array list
$location = array_search($this->item->id, array_keys($list));


//echo $location;
$rows = array_values($list);
$prev = array();
$next = array();

if ($location -1 >= 0) {
// the previous content item cannot be in the array position -1
$prev = $rows[$location -1];
}

if (($location +1) < count($rows)) {
// the next content item cannot be in an array position greater than the number of array postions
$next = $rows[$location +1];
}

$pnSpace = "";
if (JText::_('&lt') || JText::_('&gt')) {
$pnSpace = " ";
}
              
$prevlink=JRoute::_('index.php?option=com_flexicontent&view=items&cid='.$this->item->catid.'&id='.$prev->id);
$nextlink=JRoute::_('index.php?option=com_flexicontent&view=items&cid='.$this->item->catid.'&id='.$next->slug);

$limit = 1000;
if ($prev) {
$prevTitle=$prev->title;
if (JString::strlen(strip_tags($prev->introtext)) > $limit) {
$limit = JString::strpos(strip_tags($prev->introtext), " ", $limit);
$prevIntro = JString::substr(strip_tags($prev->introtext), 0, $limit). '...';
}
} else {
$prev = '';
}

if ($next) {
$nextTitle=$next->title;
if (JString::strlen(strip_tags($next->introtext)) > $limit) {
$limit = JString::strpos(strip_tags($next->introtext), " ", $limit);
$nextIntro = JString::substr(strip_tags($next->introtext), 0, $limit). '...';
}
} else {
$next = '';
}


$header='<style type="text/css">
a.PageNav:link, a.PageNav:visited { padding: 2px 8px 2px 8px; color: #DB1919;}
a.PageNav:hover {background-color: #DB1919; color: #1D1916;}
 </style>';

$mainframe->addCustomHeadTag($header);

                JHTML::_('behavior.tooltip');

if ($prev || $next) {

$html = '<div class="pagenav"><hr/>
                            ';

if ($prev)
{
$html .= '<span class="hasTip" title="'.$prevIntro.'"><a href="'. $prevlink .'" class="PageNavPrev" title="'. $prevTitle. '">
                                    '. $prevTitle. '
                                        </a></span>';
} else {
$html .= '<span>&nbsp;</span>';
}

if ($next)
{

$html .= '<span class="hasTip" style="float:right;" title="'.$nextIntro.'"><a href="'. $nextlink .'" class="PageNavNext" title="'. $nextTitle .'">
                                    '. $nextTitle .'
                                        </a></span>';
} else {
$html .= '<span>&nbsp;</span>';
}
$html .= '<hr/></div>';


echo $html;
                        

}
?>
Тоже есть свой плюс - меньше запросов.

Пример работы - Античный стиль
*

effrit

  • Moderator
  • 10132
  • 1118 / 13
  • effrit.com
хых.
я тоже подумал про шаблон - не очень гибко, но тоже вариант. особенно с учётом того, что вызов комментариев тоже через шаблон прикручен.
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

[Решено] Создание и вывод материалов

Автор Shket1983

Ответов: 1
Просмотров: 1674
Последний ответ 09.02.2012, 11:00:33
от KKAAZZOO
[Решено] Не генерируются картинки через phpthumb

Автор effrit

Ответов: 0
Просмотров: 4423
Последний ответ 23.01.2012, 15:00:31
от effrit
РЕШЕНО-Поле БАННЕР как реализовать?

Автор mishany27

Ответов: 0
Просмотров: 1759
Последний ответ 26.10.2011, 22:37:38
от mishany27
[Решено] Как выключить сообщение "Нет материалов для этой категории"

Автор kanimet

Ответов: 2
Просмотров: 3848
Последний ответ 17.09.2011, 23:53:15
от kanimet
[Решено]Не могу убрать водяной знак!

Автор mishany27

Ответов: 1
Просмотров: 3053
Последний ответ 15.08.2011, 16:30:17
от AlexX