PHP Templating API: getComments()
Posted by Mark [Elevated X Support], Last modified by AJ Hall on 30 October 2017 12:30 PM

Description:

The getComments() function gets a list of comments that are present in the system. Based on the arguments that are passed to it will determine which and how many comments are returned.

Sample Usage:

$commentobj = $api->getComments("contenttype" => "set");

$commentobj = $api->getComments(["id" => 1, "contenttype" => "set]);

$commentobj = $api->getComments([
"contenttype" => "set",
"sort" => "id",
"sort_reverse" => 1,
"countonly" => 0,
]);

echo "\nNumber of comments returned: " . $commentobj->commentcount;
echo "\nComments:\n";
print_r($commentobj->models);

Returning Attributes:

This function call will return a StdObject object with the following attributes:

comments:

This is a multi-dimensional array that returns any comments that match search criteria.

commentcount:

The number of comments returned.

Arguments:

contenttype:

This specifies the type of comment that is being fetched. This field is required.

Valid values for this field are: set, news, model, dvd, custompages, store

id:

This filters the results by model id. If set, this will only return a set of the specified model id, if it is available for release and is present on the current site.

sort:

Specify sorting order of comments.

Valid values are: id

By default, the system will sort by id.

Note: Future sorting options will be available in a future API release.

sort_reverse:

If this is set to 1, reverse the sorting order as specified within "sort"

countonly:

If specified, only return the number of areas that fit the search criteria.


(0 vote(s))
Helpful
Not helpful

Comments (0)