0

カスタム モジュールから特定のカテゴリの記事数を取得するのに苦労していますか? どの関数を使用する必要があるかについて、誰かが私を正しい方向に向けてくれませんか?

私は以下を使用しています:

$model = JModelLegacy::getInstance('Articles', 'ContentModel');
$model->setState('filter_fields.catid', 16);
$articles = $model->getItems();

しかし、私は次のものしか返されません:

object(ContentModelArticles)[134]
  protected 'cache' => 
    array
      empty
  protected 'context' => string 'com_content.articles' (length=20)
  protected 'filter_fields' => 
    array
      0 => string 'id' (length=2)
      1 => string 'a.id' (length=4)
      2 => string 'title' (length=5)
      3 => string 'a.title' (length=7)
      4 => string 'alias' (length=5)
      5 => string 'a.alias' (length=7)
      6 => string 'checked_out' (length=11)
      7 => string 'a.checked_out' (length=13)
      8 => string 'checked_out_time' (length=16)
      9 => string 'a.checked_out_time' (length=18)
      10 => string 'catid' (length=5)
      11 => string 'a.catid' (length=7)
      12 => string 'category_title' (length=14)
      13 => string 'state' (length=5)
      14 => string 'a.state' (length=7)
      15 => string 'access' (length=6)
      16 => string 'a.access' (length=8)
      17 => string 'access_level' (length=12)
      18 => string 'created' (length=7)
      19 => string 'a.created' (length=9)
      20 => string 'created_by' (length=10)
      21 => string 'a.created_by' (length=12)
      22 => string 'ordering' (length=8)
      23 => string 'a.ordering' (length=10)
      24 => string 'featured' (length=8)
      25 => string 'a.featured' (length=10)
      26 => string 'language' (length=8)
      27 => string 'a.language' (length=10)
      28 => string 'hits' (length=4)
      29 => string 'a.hits' (length=6)
      30 => string 'publish_up' (length=10)
      31 => string 'a.publish_up' (length=12)
      32 => string 'publish_down' (length=12)
      33 => string 'a.publish_down' (length=14)
      34 => string 'images' (length=6)
      35 => string 'a.images' (length=8)
      36 => string 'urls' (length=4)
      37 => string 'a.urls' (length=6)
  protected 'query' => 
    array
      empty
  protected '__state_set' => null
  protected '_db' => 
    object(JDatabaseMySQLi)[15]
      public 'name' => string 'mysqli' (length=6)
      protected 'nameQuote' => string '`' (length=1)
      protected 'nullDate' => string '0000-00-00 00:00:00' (length=19)
      protected 'dbMinimum' => string '5.0.4' (length=5)
      private '_database' (JDatabase) => string 'xxxx' (length=25)
      protected 'connection' => 
        object(mysqli)[16]
          public 'affected_rows' => null
          public 'client_info' => null
          public 'client_version' => null
          public 'connect_errno' => null
          public 'connect_error' => null
          public 'errno' => null
          public 'error' => null
          public 'field_count' => null
          public 'host_info' => null
          public 'info' => null
          public 'insert_id' => null
          public 'server_info' => null
          public 'server_version' => null
          public 'sqlstate' => null
          public 'protocol_version' => null
          public 'thread_id' => null
          public 'warning_count' => null
      protected 'count' => int 0
      protected 'cursor' => 
        object(mysqli_result)[202]
          public 'current_field' => null
          public 'field_count' => null
          public 'lengths' => null
          public 'num_rows' => null
          public 'type' => null
      protected 'debug' => boolean false
      protected 'limit' => int 0
      protected 'log' => 
        array
          empty
      protected 'offset' => int 0
      protected 'sql' => 
        object(JDatabaseQueryMySQLi)[258]
          protected 'db' => 
            &object(JDatabaseMySQLi)[15]
          protected 'type' => string 'select' (length=6)
          protected 'element' => null
          protected 'select' => 
            object(JDatabaseQueryElement)[257]
              protected 'name' => string 'SELECT' (length=6)
              protected 'elements' => 
                array
                  0 => string 'm.id, m.title, m.module, m.position, m.content, m.showtitle, m.params, mm.menuid' (length=80)
              protected 'glue' => string ',' (length=1)
          protected 'delete' => null
          protected 'update' => null
          protected 'insert' => null
          protected 'from' => 
            object(JDatabaseQueryElement)[259]
              protected 'name' => string 'FROM' (length=4)
              protected 'elements' => 
                array
                  0 => string '#__modules AS m' (length=15)
              protected 'glue' => string ',' (length=1)
          protected 'join' => 
            array
              0 => 
                object(JDatabaseQueryElement)[260]
                  protected 'name' => string 'LEFT JOIN' (length=9)
                  protected 'elements' => 
                    array
                      0 => string '#__modules_menu AS mm ON mm.moduleid = m.id' (length=43)
                  protected 'glue' => string ',' (length=1)
              1 => 
                object(JDatabaseQueryElement)[262]
                  protected 'name' => string 'LEFT JOIN' (length=9)
                  protected 'elements' => 
                    array
                      0 => string '#__extensions AS e ON e.element = m.module AND e.client_id = m.client_id' (length=72)
                  protected 'glue' => string ',' (length=1)
          protected 'set' => null
          protected 'where' => 
            object(JDatabaseQueryElement)[261]
              protected 'name' => string 'WHERE' (length=5)
              protected 'elements' => 
                array
                  0 => string 'm.published = 1' (length=15)
                  1 => string 'e.enabled = 1' (length=13)
                  2 => string '(m.publish_up = '0000-00-00 00:00:00' OR m.publish_up <= '2013-10-07 14:10:50')' (length=79)
                  3 => string '(m.publish_down = '0000-00-00 00:00:00' OR m.publish_down >= '2013-10-07 14:10:50')' (length=83)
                  4 => string 'm.access IN (1,1)' (length=17)
                  5 => string 'm.client_id = 0' (length=15)
                  6 => string '(mm.menuid = 113 OR mm.menuid <= 0)' (length=35)
              protected 'glue' => string ' AND ' (length=5)
          protected 'group' => null
          protected 'having' => null
          protected 'columns' => null
          protected 'values' => null
          protected 'order' => 
            object(JDatabaseQueryElement)[264]
              protected 'name' => string 'ORDER BY' (length=8)
              protected 'elements' => 
                array
                  0 => string 'm.position, m.ordering' (length=22)
              protected 'glue' => string ',' (length=1)
          protected 'union' => null
          protected 'autoIncrementField' => null
      protected 'tablePrefix' => string 'joomla_' (length=7)
      protected 'utf' => boolean true
      protected 'errorNum' => int 0
      protected 'errorMsg' => string '' (length=0)
      protected 'hasQuoted' => boolean false
      protected 'quoted' => 
        array
          empty
  protected 'name' => string 'articles' (length=8)
  protected 'option' => string 'com_content' (length=11)
  protected 'state' => 
    object(JObject)[279]
      protected '_errors' => 
        array
          empty
      public 'filter_fields.catid' => int 16
  protected 'event_clean_cache' => string 'onContentCleanCache' (length=19)
  protected '_errors' => 
    array
      empty
4

1 に答える 1