/**
  * Loads a template resource
  *
  * @param resource string
  * @return mixed PHPSTLTemplate, PHPSTLTemplateProvider::DECLINE, or
  * PHPSTLTemplateProvider::FAIL
  * @see PHPSTL::load
  */
 public function load($resource)
 {
     $pl = strlen(self::$Prefix);
     if (strlen($resource) > $pl) {
         $id = (int) substr($resource, $pl);
         if ($id == 0) {
             return PHPSTLTemplateProvider::FAIL;
         }
         $node = CMSNode::load((int) $id);
         if (!isset($node)) {
             return PHPSTLTemplateProvider::FAIL;
         }
     } else {
         $node = CMSNode::loadResource($resource);
         if (!isset($node)) {
             return PHPSTLTemplateProvider::DECLINE;
         }
     }
     return $this->createTemplate($resource, $node);
 }
Esempio n. 2
0
 public function doNodeLoad(CMSNode $node, $extra)
 {
     $this->response = $node->serialize();
 }