Difference between revisions of "Core/get"
From PunchCMS
(→Returns) |
(→Returns) |
||
Line 10: | Line 10: | ||
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'''. | 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 === | === 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 | + | 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 [http://www.php.net/manual/en/function.is-object.php|is_object()] method. |
=== Example === | === Example === |
Revision as of 16:59, 25 December 2008
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. }