summaryrefslogtreecommitdiff
path: root/framework/Web/Services
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/Services')
-rw-r--r--framework/Web/Services/TPageService.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/framework/Web/Services/TPageService.php b/framework/Web/Services/TPageService.php
index be865d89..a52efd13 100644
--- a/framework/Web/Services/TPageService.php
+++ b/framework/Web/Services/TPageService.php
@@ -102,6 +102,10 @@ class TPageService extends \Prado\TService
*/
const PAGE_FILE_EXT='.page';
/**
+ * Prefix of Pages used for instantiating new pages
+ */
+ const PAGE_NAMESPACE_PREFIX = 'Application\\Pages\\';
+ /**
* @var string root path of pages
*/
private $_basePath=null;
@@ -490,21 +494,22 @@ class TPageService extends \Prado\TService
if($hasClassFile)
{
$className=basename($path);
- if(!class_exists($className,false))
+ $namespacedClassName = static::PAGE_NAMESPACE_PREFIX .str_replace('.', '\\', $pagePath);
+ if(!class_exists($className,false) && !class_exists($namespacedClassName, false))
include_once($path.Prado::CLASS_FILE_EXT);
+
+ if(!class_exists($className,false))
+ $className = $namespacedClassName;
}
else
{
$className=$this->getBasePageClass();
- Prado::using($className);
- if(($pos=strrpos($className,'.'))!==false)
- $className=substr($className,$pos+1);
}
if(!class_exists($className,false) || ($className!=='TPage' && !is_subclass_of($className,'TPage')))
throw new THttpException(404,'pageservice_page_unknown',$pagePath);
- $page=new $className;
+ $page=Prado::createComponent($className);
$page->setPagePath($pagePath);
if($hasTemplateFile)