Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • padunic Friend
    #146298

    Hi,

    its possible change something to JaNews2 get articles by last date?

    Best regards.

    Padunic

    padunic Friend
    #324790

    <em>@padunic 154329 wrote:</em><blockquote>Hi,

    its possible change something to JaNews2 get articles by last date?

    Best regards.

    Padunic</blockquote>

    Please, i’m really need help about that. Please.

    I take articles from RSS and JANews show in frontpage the first article and not the last.
    I dont know how fix this.

    Thanks.

    Anonymous Moderator
    #324877
    padunic Friend
    #325007

    <em>@JA Developer 154518 wrote:</em><blockquote>Hi padunic

    Please check this link: http://www.joomlart.com/forums/topic/janews-2-display-categories/</blockquote>
    Hi, thank you for your reply.

    Maybe because my english is bad i do not make myself clear. Sorry.

    My JANews2 dont display the last articles updated in frontpage, but the first articles published.

    I tried change config to “Modified Date”, “Created Date”, “Order” and still showing just the first date.

    Regards

    Anonymous Moderator
    #325359

    Please open helper.php file, find this function:


    function getGroupList($secid, $items, $ordering, $showcontentfrontpage = false) {
    global $mainframe;
    $db = & JFactory::getDBO ();
    $user = & JFactory::getUser ();
    $aid = $user->get ( 'aid', 0 );

    $contentConfig = &JComponentHelper::getParams ( 'com_content' );
    $noauth = ! $contentConfig->get ( 'shownoauth' );

    //Get category ids:
    $catids = $this->loadCategories ( $secid );

    jimport ( 'joomla.utilities.date' );
    $date = new JDate ( );
    $now = $date->toMySQL ();

    $nullDate = $db->getNullDate ();
    $result = array ();
    $j = 0;
    foreach ( $catids as $cat ) {
    $catid = $catids[$j]->category->id;
    // query to determine article count
    $query = 'SELECT a.*,u.name as creater,cc.description as catdesc, cc.title as cattitle,s.description as secdesc, s.title as sectitle,' . ' 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,' . ' CASE WHEN CHAR_LENGTH(s.alias) THEN CONCAT_WS(":", s.id, s.alias) ELSE s.id END as secslug' . ' FROM #__content AS a' . ' INNER JOIN #__categories AS cc ON cc.id = a.catid' . ' INNER JOIN #__sections AS s ON s.id = a.sectionid' . ' left JOIN #__users AS u ON a.created_by = u.id';
    $query .= ' WHERE a.state = 1 ' . ($noauth ? ' AND a.access <= ' . ( int ) $aid . ' AND cc.access <= ' . ( int ) $aid . ' AND s.access <= ' . ( int ) $aid : '') . ' AND (a.publish_up = ' . $db->Quote ( $nullDate ) . ' OR a.publish_up <= ' . $db->Quote ( $now ) . ' ) ' . ' AND (a.publish_down = ' . $db->Quote ( $nullDate ) . ' OR a.publish_down >= ' . $db->Quote ( $now ) . ' )' . "n AND cc.id=" . ( int ) $catid . ' AND cc.section = s.id' . ' AND cc.published = 1' . ' AND s.published = 1';
    if (! $showcontentfrontpage) {
    $query .= ' AND a.id not in (SELECT content_id FROM #__content_frontpage )';
    }

    //$query .= ' ORDER BY a.created DESC' ;
    $query .= ' ORDER BY a.' . $ordering;

    $db->setQuery ( $query, 0, $items );
    $rows = $db->loadObjectList ();
    global $mainframe;
    JPluginHelper::importPlugin ( 'content' );
    $dispatcher = & JDispatcher::getInstance ();
    $params = & $mainframe->getParams ( 'com_content' );
    $limitstart = JRequest::getVar ( 'limitstart', 0, '', 'int' );

    for($i = 0; $i < count ( $rows ); $i ++) {
    $rows [$i]->text = $rows [$i]->introtext;
    $results = $dispatcher->trigger ( 'onPrepareContent', array (& $rows [$i], & $params, $limitstart ) );
    $rows [$i]->introtext = $rows [$i]->text;
    }

    $catids[$j]->contents = $rows;
    $j++;
    }
    return $catids;
    }

    and change to:


    function getGroupList($secid, $items, $ordering, $showcontentfrontpage = false) {
    global $mainframe;
    $db = & JFactory::getDBO ();
    $user = & JFactory::getUser ();
    $aid = $user->get ( 'aid', 0 );

    $contentConfig = &JComponentHelper::getParams ( 'com_content' );
    $noauth = ! $contentConfig->get ( 'shownoauth' );

    //Get category ids:
    $catids = $this->loadCategories ( $secid );

    jimport ( 'joomla.utilities.date' );
    $date = new JDate ( );
    $now = $date->toMySQL ();

    $nullDate = $db->getNullDate ();
    $result = array ();
    $j = 0;
    foreach ( $catids as $cat ) {
    $catid = $catids[$j]->category->id;
    // query to determine article count
    $query = 'SELECT a.*,u.name as creater,cc.description as catdesc, cc.title as cattitle,s.description as secdesc, s.title as sectitle,' . ' 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,' . ' CASE WHEN CHAR_LENGTH(s.alias) THEN CONCAT_WS(":", s.id, s.alias) ELSE s.id END as secslug' . ' FROM #__content AS a' . ' INNER JOIN #__categories AS cc ON cc.id = a.catid' . ' INNER JOIN #__sections AS s ON s.id = a.sectionid' . ' left JOIN #__users AS u ON a.created_by = u.id';
    $query .= ' WHERE a.state = 1 ' . ($noauth ? ' AND a.access <= ' . ( int ) $aid . ' AND cc.access <= ' . ( int ) $aid . ' AND s.access <= ' . ( int ) $aid : '') . ' AND (a.publish_up = ' . $db->Quote ( $nullDate ) . ' OR a.publish_up <= ' . $db->Quote ( $now ) . ' ) ' . ' AND (a.publish_down = ' . $db->Quote ( $nullDate ) . ' OR a.publish_down >= ' . $db->Quote ( $now ) . ' )' . "n AND cc.id=" . ( int ) $catid . ' AND cc.section = s.id' . ' AND cc.published = 1' . ' AND s.published = 1';
    if (! $showcontentfrontpage) {
    $query .= ' AND a.id not in (SELECT content_id FROM #__content_frontpage )';
    }

    $query .= ' ORDER BY a.created DESC' ;
    //$query .= ' ORDER BY a.' . $ordering;

    $db->setQuery ( $query, 0, $items );
    $rows = $db->loadObjectList ();
    global $mainframe;
    JPluginHelper::importPlugin ( 'content' );
    $dispatcher = & JDispatcher::getInstance ();
    $params = & $mainframe->getParams ( 'com_content' );
    $limitstart = JRequest::getVar ( 'limitstart', 0, '', 'int' );

    for($i = 0; $i < count ( $rows ); $i ++) {
    $rows [$i]->text = $rows [$i]->introtext;
    $results = $dispatcher->trigger ( 'onPrepareContent', array (& $rows [$i], & $params, $limitstart ) );
    $rows [$i]->introtext = $rows [$i]->text;
    }

    $catids[$j]->contents = $rows;
    $j++;
    }
    return $catids;
    }

Viewing 5 posts - 1 through 5 (of 5 total)

This topic contains 5 replies, has 2 voices, and was last updated by Anonymous 14 years, 12 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum