/** * Makes GET request to the URL and return the results to the template’s $_text array, * where it will be rendered to the final template output * @param type $tree * @param type $content * @return type */ protected function _partial($tree, $content) { $address = trim($tree["raw"], " /"); if (StringMethods::indexOf($address, "http") != 0) { $host = RequestMethods::server("HTTP_HOST"); $address = "http://{$host}/{$address}"; } $request = new Request(); $response = addslashes(trim($request->get($address))); return "\$_text[] = \"{$response}\";"; }
/** * Make GET request to given URL and place the results * in the template file * @param array $tree Node from the template tree * @param mixed $content Content of node * @return string String to be included in template */ protected function _partial($tree, $content) { $address = trim($tree["raw"], " /"); // Convert a relative URl to an absolute URL if (StringMethods::indexOf($address, "http") != 0) { $host = RequestMethods::server("HTTP_HOST"); $address = "http://{$host}/{$address}"; } // Make GET request to URL and return results to // template $_text array $request = new Request(); $response = addslashes(trim($request->get($address))); return "\$_text[] = \"{$response}\";"; }