Core/getElementById
From PunchCMS
PCMS_Client->getElementById(elementId)
Overview
Get an element or folder with a specific id from the CMS.
Arguments
elementId [integer]
Id of the element or folder you are looking for.
Returns
If an element is found matching the id this method returns a valid Element object. Otherwise NULL. That way you can test if you get a valid return using the is_object() method.
Example
$objCms = PCMS_Client::getInstance(); $objElement = $objCms->getElementById(3442); if (is_object($objElement)) { // Found Element with id 3442. }