Difference between revisions of "Core/getAliasId"
From PunchCMS
(→Example) |
|||
Line 9: | Line 9: | ||
=== Example === | === Example === | ||
<source lang="php"> | <source lang="php"> | ||
+ | <?php | ||
+ | |||
$objCms = PCMS_Client::getInstance(); | $objCms = PCMS_Client::getInstance(); | ||
Line 20: | Line 22: | ||
// Found the 'info' Element. | // Found the 'info' Element. | ||
} | } | ||
+ | |||
+ | ?> | ||
</source> | </source> |
Revision as of 22:20, 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
<?php $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. } ?>