Previous / next in blogitems

More
13 years 3 months ago #12821 by micker
Replied by micker on topic Previous / next in blogitems
yes i understant !
but your are must dev then me :lol:
i think you can find a solution !
thanks for shareing

edit i find it ... it's in comment ....
for me order by date and word limit 100
Code:
<?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.created'; $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 = 200; 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. ' </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 .' </span>'; } else { $html .= '<span>&nbsp;</span>'; } $html .= '<hr/></div>'; echo $html; } ?>
it's work quasi-perfect !!!
some time some error ..

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.256 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline