Difference between revisions of "Core/getAliasId"

From PunchCMS
Jump to: navigation, search
(New page: __NOTOC__ ==== PCMS_Client->getAliasId() ==== === Overview === Get the element id converted from the curent URL alias. === Arguments === None === Returns === The id of the Element currentl...)
 
(Example)
 
(2 intermediate revisions by the same user not shown)
Line 15: Line 15:
 
*/
 
*/
 
$intId = $objCms->getAliasId();
 
$intId = $objCms->getAliasId();
$objElement = $objCms->[[Core/getElementById|getElementById]]($intId);
+
$objElement = $objCms->getElementById($intId);
  
 
if (is_object($objElement)) {
 
if (is_object($objElement)) {

Latest revision as of 22:21, 25 December 2008

PCMS_Client->getAliasId()

Overview

Get the element id converted from the curent URL alias.

Arguments

None

Returns

The id of the Element currently active if the Alias is found. Otherwise 0.

Example

$objCms = PCMS_Client::getInstance();
 
/* The url is http://www.domain.com/info and there is an alias 
 * in the CMS with the name 'info'.
*/
$intId = $objCms->getAliasId();
$objElement = $objCms->getElementById($intId);
 
if (is_object($objElement)) {
    // Found the 'info' Element.
}