How do I select items from some categories in descendting order

2 views
Skip to first unread message

Nelson o mesmo

unread,
Aug 21, 2013, 1:31:03 PM8/21/13
to joomla-en...@googlegroups.com



        Hello!
        How do I select items from some categories in descending order?
       
        // helper.php - Joomla 3.1 - Gantry Framework

        public static function getListForUser($params)
           {
                $db = JFactory::getDbo();

        // Get an instance of the generic articles model
        $model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
        $app = JFactory::getApplication();
               
                // Set the filters based on the module params
        $model->setState('list.start', 0);
        $model->setState('list.limit', 9);
        //$model->setState('list.limit', (int) $params->get('count', 7));
        $model->setState('filter.published', 1);
        $model->setState('filter.featured', 1);
       
        // Show cateries
        $model->setState('filter.catid', array('catid' => 25, 29, 30, 45,);   
       
        // Order by ID
        $model->setState('list.ordering', 'id');
        $model->setState('list.direction', 'DESC');


                      $items = $model->getItems();
                     
                      return $items;
           }
Reply all
Reply to author
Forward
0 new messages