/** * Call a REST method if authorized, then render the REST service view * * @param String $view the view to render (ignored) * @param Array $options an array of rendering options (ignored) * @return String the contents to render (REST data in a content type) */ public function render($view = NULL, $options = array()) { $method = $this->request_method(); $options['type'] = $this->request_type(); $options['folder'] = 'REST'; // to use the "yawf/views/en/REST" folder return parent::render($method, $options); }
/** * Render the requested view by using the cache * * @return String the view contents to render */ public function render($view = null, $options = array()) { // First look for cached contents $this->set_cache_path(); $contents = $this->read_cache(); if ($contents) { if ($type = $this->request_type()) { if ($content_type = array_key(self::$content_types, $type)) { header("Content-Type: {$content_type}"); } } return $contents; } // If not found or expired, write new cached contents $contents = parent::render(); if ($this->cache_secs) { $this->write_cache($contents); } return $contents; }