Documentation

CForumMessage::GetListEx

CDBResult
GetListEx(
 [array arOrder [,
 array arFilter [,
 bool bCount [,
 int iNum]]]]
);

The method GetListEx returns a filtered and sorted list of messages including all bound data.

Parameters

ParameterDescription
arOrder An array of the format Array(by1=>order1[, by2=>order2 [, ..]]), where:

by - the field by which the list is to be sorted. The following values are possible:
  • AUTHOR_NAME - the name of a message author;
  • POST_DATE - the date the message was created;
  • FORUM_ID - the forum ID;
  • TOPIC_ID - the topic ID;
  • APPROVED - the message is approved and published;
  • ID - the message ID.
order - sort order. The following values are possible:
  • ASC - ascending;
  • DESC - descending;
Optional. The default value is Array("ID"=>"ASC").
arFilter An array of the format array("filter field"=>"filter value" [, ...]).

The "filter field" can be one of the following:
  • ID - the message ID;
  • AUTHOR_NAME - the name of a message author;
  • AUTHOR_ID - the message author ID;
  • FORUM_ID - the forum ID;
  • TOPIC_ID - the topic ID;
  • APPROVED - the message is approved and published.
The filtered field may contain one of the following condition operators before the name:
  • "!" - not equal;
  • "<" - less than;
  • "<=" - less or equal;
  • ">" - more than;
  • ">=" - more or equal.
Optional. By default, records are not filtered.
bCount If parameter is true, only the number of messages that conforms to the specified filter is returned.
Optional. The default value is false.
iNum Maximum number of records returned. If the parameter iNum is not zero, a maximum of iNum records is returned. Not all databases support this feature. If the feature is not supported, this parameter is ignored. Optional. The default value is 0.

Return Values

Returns an object of the CDBResult class.

See Also

  • CDBResult
  • Message fields

    Example


    
    <?
    // select all the published messages of the topic 
    // with the ID of $TID in the reverse message creation order
    $db_res = CForumMessage::GetListEx(array("ID"=>"DESC"), array("TOPIC_ID"=>$TID));
    while ($ar_res = $db_res->Fetch())
    {
      echo "<pre>";
      print_r($ar_res);
      echo "</pre><br>";
    }
    ?>
  • © «Bitrix24», 2001-2024
    Up