Core/get
From PunchCMS
PCMS_Client->get([elementApiName], [recursive])
Overview
Get the first element or folder from the root folder of the CMS. It is possible to select an element with a specific api name and to search recursivly through the element tree.
Arguments
elementApiName [string, optional]
API name of the element you are looking for.
recursive [boolean, optional]
Indicate if you want to search trough the tree or only on the first level. Setting this to TRUE can be very time consuming. Default is FALSE.
Returns
If an element is found matching the criteria this method returns a valid Element object. Otherwise NULL. That way you can test if you get a valid return using the [[1]] method.
Example
$objCms = PCMS_Client::getInstance(); $objElement = $objCms->get("Menu"); if (is_object($objElement)) { // Found Element with API name. }