Example #1
0
 public function RenderBlock($path)
 {
     $mdlPage = new Model_Page();
     $uriObj = new Digitalus_Uri($path);
     $pointer = $mdlPage->fetchPointer($uriObj->toArray());
     $pageObj = $mdlPage->open($pointer, $mdlPage->getDefaultVersion());
     $namespace = $pageObj->page->namespace . '_' . $pointer;
     return $this->view->RenderContentTemplate($pageObj->page->content_template, $pageObj->content, $namespace);
 }
Example #2
0
 public static function loadPage($uri = null, $buildStack = null, Digitalus_Page $page = null, Zend_View $view = null, $persist = null)
 {
     // fetch the builder stack from config
     $config = Zend_Registry::get('config');
     if ($buildStack == null) {
         $buildStack = $config->builder->stack;
     }
     // set whether to persist this page as the current page
     if ($persist === null) {
         if (strtolower($config->builder->persistPage) == 'true') {
             $persist = true;
         } else {
             $persist = false;
         }
     }
     $pathToBuildStack = self::PATH_TO_BUILDERS . '/' . $buildStack;
     //load the builder stack
     $stack = simplexml_load_file($pathToBuildStack);
     // get the uri
     $uri = new Digitalus_Uri($uri);
     $uriArray = $uri->toArray();
     //create the page if one is not passed
     if ($page == null) {
         $page = new Digitalus_Page($uriArray);
     }
     if ($view != null) {
         $page->setView($view);
     }
     // actions is a stack of all of the builder action files
     $actions = array();
     foreach ($stack as $action) {
         $attributes = $action->attributes();
         $className = self::BASE_CLASSNAME . (string) $attributes['class'];
         $methodName = (string) $attributes['method'];
         if (isset($actions[$className])) {
             $class = $actions[$className];
         } else {
             $class = new $className($page, $attributes, $persist);
             $actions[$className] = $class;
         }
         $class->{$methodName}($attributes);
     }
     return $page;
 }
Example #3
0
 /**
  * if there is a redirector set for the current page this will return
  * the path and response code
  *
  * @return stdClass object
  */
 public function getCurrentRedirector()
 {
     $uri = $_SERVER['REQUEST_URI'];
     if ($newPath = $this->get($uri)) {
         $response = new stdClass();
         if ($newPath->response_code > 0) {
             $response->responseCode = intval($newPath->response_code);
         }
         if (Zend_Uri::check($newPath->response)) {
             //this is a valid http uri.  return as a string to redirect
             $response->path = $newPath->response;
             return $response;
         } else {
             //this is not a valid http uri.  return as an array to find the page
             $uriObj = new Digitalus_Uri();
             $response->path = $uriObj->toArray($newPath->response);
             return $response;
         }
     }
 }
Example #4
0
 public function pageExists(Digitalus_Uri $uri)
 {
     if ($this->_fetchPointer($uri->toArray(), 0) || $uri == null) {
         return true;
     } else {
         return false;
     }
 }