Documentation

This is some example code:

$page = Page::getCurrentPage();
//get attribute
$page_selector = $page->getCollectionAttributeValue('page_selector_handle');
//if there is a page selected
if($page_selector > 0) {
Loader::model('page');
//get the page object by id
$npage = Page::getByID($page_selector);
//if its a valid page
if(is_object($npage) && !$npage->isError()) {
//get the path
$page_target = $npage->getcollectionpath();
}
}