public function getDomainByPageId($idPage)
	{
	    if (empty($idPage))
	        return null;
        
        // Retrieve cache version if front mode to avoid multiple calls
        $cacheKey = 'getDomainByPageId_' . $idPage;
        $cacheConfig = 'engine_page_services';
        $melisEngineCacheSystem = $this->serviceLocator->get('MelisEngineCacheSystem');
        $results = $melisEngineCacheSystem->getCacheByKey($cacheKey, $cacheConfig);
        if (!empty($results)) return $results;
	        
        $domainStr = '';
		$melisPage = $this->getServiceLocator()->get('MelisEnginePage');
		$datasPage = $melisPage->getDatasPage($idPage);
		$datasTemplate = $datasPage->getMelisTemplate();
		if (!empty($datasTemplate) && !empty($datasTemplate->tpl_site_id))
		{
			$melisEngineTableSite = $this->getServiceLocator()->get('MelisEngineTableSite');
			$datasSite = $melisEngineTableSite->getSiteById($datasTemplate->tpl_site_id, getenv('MELIS_PLATFORM'));
			if ($datasSite)
			{
				$datasSite = $datasSite->current();
				if (!empty($datasSite))
				{
					$scheme = 'http';
					if (!empty($datasSite->sdom_scheme))
						$scheme = $datasSite->sdom_scheme;
					
					$domain = $datasSite->sdom_domain;
					
					if ($domain != '')
						$domainStr = $scheme . '://' . $domain;
				}
			}
		}

		// Save cache key
		$melisEngineCacheSystem->setCacheByKey($cacheKey, $cacheConfig, $domainStr);
		
		return $domainStr;
	}
public function getDomainByPageId($idPage)
	{
	    if (empty($idPage))
	        return null;
        
        // Retrieve cache version if front mode to avoid multiple calls
        $cacheKey = 'getDomainByPageId_' . $idPage;
        $cacheConfig = 'engine_page_services';
        $melisEngineCacheSystem = $this->serviceLocator->get('MelisEngineCacheSystem');
        $results = $melisEngineCacheSystem->getCacheByKey($cacheKey, $cacheConfig);
        if (!empty($results)) return $results;
	        
        $domainStr = '';
		$melisPage = $this->getServiceLocator()->get('MelisEnginePage');
		$datasPage = $melisPage->getDatasPage($idPage);
		$datasTemplate = $datasPage->getMelisTemplate();
		if (!empty($datasTemplate) && !empty($datasTemplate->tpl_site_id))
		{
			$melisEngineTableSite = $this->getServiceLocator()->get('MelisEngineTableSite');
			$datasSite = $melisEngineTableSite->getSiteById($datasTemplate->tpl_site_id, getenv('MELIS_PLATFORM'));
			if ($datasSite)
			{
				$datasSite = $datasSite->current();
				if (!empty($datasSite))
				{
					$scheme = 'http';
					if (!empty($datasSite->sdom_scheme))
						$scheme = $datasSite->sdom_scheme;
					
					$domain = $datasSite->sdom_domain;
					
					if ($domain != '')
						$domainStr = $scheme . '://' . $domain;
				}
			}
		}

		// Save cache key
		$melisEngineCacheSystem->setCacheByKey($cacheKey, $cacheConfig, $domainStr);
		
		return $domainStr;
	}
public function getDomainByPageId ( $ idPage ) { if ( empty ( $ idPage ) ) return null ; // Retrieve cache version if front mode to avoid multiple calls $ cacheKey = 'getDomainByPageId_' . $ idPage ; $ cacheConfig = 'engine_page_services' ; $ melisEngineCacheSystem = $ this -> serviceLocator -> get ( 'MelisEngineCacheSystem' ) ; $ results = $ melisEngineCacheSystem -> getCacheByKey ( $ cacheKey , $ cacheConfig ) ; if ( ! empty ( $ results ) ) return $ results ; $ domainStr = '' ; $ melisPage = $ this -> getServiceLocator ( ) -> get ( 'MelisEnginePage' ) ; $ datasPage = $ melisPage -> getDatasPage ( $ idPage ) ; $ datasTemplate = $ datasPage -> getMelisTemplate ( ) ; if ( ! empty ( $ datasTemplate ) && ! empty ( $ datasTemplate -> tpl_site_id ) ) { $ melisEngineTableSite = $ this -> getServiceLocator ( ) -> get ( 'MelisEngineTableSite' ) ; $ datasSite = $ melisEngineTableSite -> getSiteById ( $ datasTemplate -> tpl_site_id , getenv ( 'MELIS_PLATFORM' ) ) ; if ( $ datasSite ) { $ datasSite = $ datasSite -> current ( ) ; if ( ! empty ( $ datasSite ) ) { $ scheme = 'http' ; if ( ! empty ( $ datasSite -> sdom_scheme ) ) $ scheme = $ datasSite -> sdom_scheme ; $ domain = $ datasSite -> sdom_domain ; if ( $ domain != '' ) $ domainStr = $ scheme . '://' . $ domain ; } } } // Save cache key $ melisEngineCacheSystem -> setCacheByKey ( $ cacheKey , $ cacheConfig , $ domainStr ) ; return $ domainStr ; }
Gets the domain as define in site table for a page id

@param int $idPage
@return string The domain with the scheme
Gets the domain as define in site table for a page id