Returns list of blog posts by the arFilter, sorted by the arOrder. Non-static method.
Note: filtration by the category ID is performed as follows: CATEGORY_ID_F. As a result, the category IDs, separated by commas, will be retrieved.
Method parameters
Parameter
Description
arOrder
Array for sorting of the result. Array of the array("sorting field"=>"sorting direction" [, ...]) type
Field for sorting can have the following values:
ID - blog post ID;
TITLE - blog post header;
BLOG_ID - blog ID;
BLOG_ACTIVE -
active blog attribute
Standard GetList selects entries from inactive blogs as well. To exclude inactive blogs from GetList results, specify as follows: $arFilter = Array ( "BLOG_ACTIVE" => "Y" );
;
AUTHOR_ID - blog post author ID;
DETAIL_TEXT - blog post text;
DATE_CREATE - date when blog post is created;
DATE_PUBLISH - date when blog post is published;
KEYWORDS - blog post keywords;
PUBLISH_STATUS - blog post publication status;
ATRIBUTE - blog post attributes;
ENABLE_TRACKBACK - specifies whether trackbacks are enabled for the post;
ENABLE_COMMENTS - specifies whether comments are enabled to this post;
NUM_COMMENTS - contains number of comments;
NUM_TRACKBACKS - contains number of trackbacks;
AUTHOR_LOGIN - blog post author login;
AUTHOR_NAME - blog post author name;
AUTHOR_LAST_NAME - blog post author last name;
AUTHOR_EMAIL - blog post author email;
VIEWS — sorting by the number of views.
Optional. By default, filtering is performed by descension of the blog post ID.
arFilter
Array of the array("filtered field"=>"filter value" [, ...]) type.
Filtered field can have the following values:
ID - blog post ID;
TITLE - blog post header;
BLOG_ID - blog ID;
AUTHOR_ID - blog post author ID;
DETAIL_TEXT - blog post text;
DATE_CREATE - date when blog post is created;
DATE_PUBLISH - date when blog post is published;
DATE_PUBLISH_DAY - day when blog post is published;
DATE_PUBLISH_MONTH - month when blog post is published;
DATE_PUBLISH_YEAR - year when blog post is published;
KEYWORDS - blog post keywords;
PUBLISH_STATUS - blog post [link=90538]publication status[/link];
CATEGORY_ID_F - blog post category ID;
ATRIBUTE - blog post attributes;
ENABLE_TRACKBACK - specifies whether trackbacks are enabled for the blog post;
ENABLE_COMMENTS - specifies whether comments are enabled for the comment;
NUM_COMMENTS - contains number of comments;
NUM_TRACKBACKS - contains number of trackbacks;
AUTHOR_LOGIN - blog post author login;
AUTHOR_NAME - blog post author name;
AUTHOR_LAST_NAME - blog post author last name;
AUTHOR_EMAIL - blog post author email;
VIEWS — sorting by the number of views.
Type of filtration can be specified in front of the name of filtered field:
"!" - not equal
"<" - less
"<=" - less or equal
">" - more
">=" - more or equal
"filter values" - single value or an array.
Optional. `By default, records are not filtered.
arGroupBy
Array of fields by which the records are grouped. The array has the following structure:
Any field can be specified as "field_nameN". The following can be specified as aggregate function:
COUNT - number count;
AVG - average value calculation;
MIN - minimal value calculation;
MAX - maximum value calculation;
SUM - sum calculation.
If the array is empty, the method will return the number of records that satisfy the filter.
Optional. By default - false - means that the result will not be grouped.
arNavStartParams
Array of selection parameters. Can contain the following keys:
"nTopCount" - number of records returned by the method will be limited from above by the value of this key
any key, accepted by the CDBResult::NavQuery method as the third parameter.
Optional. By default - false - means that there are no sample parameters.
arSelectFields
arSelectFields
Array of record fields, which will be returned by the method. Only those fields that are needed can be specified. If there is a "*" value present in the array - all available fields will be returned.
Optional. By default - empty array() - means that all fields of the request's main table will be returned.
Note: Filtering by published status cannot be passed into the blog.blog component. To do that, you must copy the standard component to your namespace and manually specify the verification of published status.
<?
// select all published blog posts for all blogs for April 2007
// which have more then two comments
$SORT = Array("DATE_PUBLISH" => "DESC", "NAME" => "ASC");
$arFilter = Array(
"PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH,
"DATE_PUBLISH_MONTH" => '04',
"DATE_PUBLISH_YEAR" => '2007',
">NUM_COMMENTS" => 2
);
$dbPosts = CBlogPost::GetList(
$SORT,
$arFilter
);
while ($arPost = $dbPosts->Fetch())
{
print_r($arPost);
}
?>
// select all blog posts of the blog with the title that includes the word "movie".
$arFilter = Array ( "~TITLE" => "%movie%" );