« Back to Product

Documentation

IPS_GetCategory

 array IPS_GetCategory (int $CategoryID) 

Parameters

CategoryID

ID of the category

Returns

The following information is available as key => value pairs:

Index Type Description
CategoryID integer ID of the category

Description

The function returns an array with information about the category with the ID CategoryID. Apart from their ID, categories have no properties of their own, so the array only contains the entry CategoryID. This function is documented for completeness only.

If no category with the ID CategoryID exists, the function fails with "Category #... does not exist". This also applies if the ID belongs to a different object type (e.g. a variable).

Warning

The useful information about a category, such as its name, ident, parent, position or visibility, are general object properties and can be read with IPS_GetObject. To only check whether a category exists, IPS_CategoryExists can be used.

Example

print_r(IPS_GetCategory(12345));

/* e.g. returns:
Array
(
    [CategoryID] => 12345
)
*/

// Name and parent are available via IPS_GetObject
$object = IPS_GetObject(12345);
echo $object['ObjectName'];
Any questions?