PHP Templating API: getDVDs() Print

  • 0

Description:

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

Sample Usage:

$dvdobj = $api->getDVDs();

$dvdobj = $api->getDVDs(["id" => 1]);

$dvdobj = $api->getDVDs([
"page" => 1,
"id" => 1,
"numperpage" => 20,
"studioid" => 1,
"startwith" => "A",
"sort" => "date",
"sort_reverse" => "1",
"subsiteid" => 1,
]);

echo "\nNumber of DVDs returned: " . $dvdobj->dvdcount;
echo "\nNumber of DVDs total: " . $dvdobj->dvdtotal;
echo "\nNumber of pages: " . $dvdobj->numpages;
echo "\nDVDs:\n";
print_r($dvdobj->dvds);

Returning Attributes:

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

dvds:

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

dvdcount:

The number of sets within the dvds attribute.

numpages:

A total number of pages that are available. For instance, if dvdtotal = 400 and the system has a numperpage value of 20, this value will be 20.

dvdtotal:

A total number of DVDs that are available, regardless of pagination.

Arguments:

page:

This paginates the DVD list. This way, if you specify "page" => 2, it will show a different list of DVDs than if you specify "page" => 1.

This is useful if the page you're calling this function on is paginated and you want to show different updates on page 2 of your page than page 1.

By default, the system sets this value to 1 if not specified when passing along to the system.

id:

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

numperpage:

If specified, determines the maximum number of results to show.

By default, the system looks at the value of "DVDs per page" under Plugins -> DVDs -> Configure.

studioid:

If specified, only return DVDs that belong to the specified Studio Id.

By default, the returns all DVDs regardless of what Studio Id they are affiliated with.

startwith:

If specified, only show DVDs that begin with the specified letter.

By default, the system does not filter results by letter.

sort:

Specify sorting order of sets.

Valid values are: name, date, rating, random.

By default, the system will sort by date.

Note: Doing a database sort by random creates a temporary table within mysql, and may result in reduced performance. Only choose this sorting option when absolutely necessary.

sort_reverse:

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

subsiteid:

If specified, limit DVDs belonging to a specified all-access subsite id. If this value is set to 0, show sets from all sites.

By default, the system will detect if the current area belongs to an all-access subsite, and use that value.

Note: If you specify a non-zero value for subsiteid, all-access must be available within this system. Otherwise, an Exception will be triggered.



Was this answer helpful?

« Back