/**
* Gets the localized navigation title of a page by the given $pid.
* Returns an empty string, if the page was not found.
*
* @param integer $pid the page ID
*
* @return string the localized navigation title
*/
public function getPageTitleByPid($pid) {
$query = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'title, nav_title',
'pages_language_overlay',
'pid = '.intval($pid).' AND sys_language_uid = '.intval($GLOBALS['TSFE']->sys_language_uid).' AND deleted = 0 AND hidden = 0'
);
if ($GLOBALS['TYPO3_DB']->sql_num_rows($query) === 0) {
$query = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'title, nav_title',
'pages',
'uid = '.intval($pid).' AND deleted = 0 AND hidden = 0'
);
}
while ($page = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($query)) {
return $page['nav_title'] ? $page['nav_title'] : $page['title'];
}
return '';
}