Can I add admin links with dynamic JavaScript from my controller in CodeIgniter 2? -
i want cache of controllers’ output, of pages need have links can add , edit info. if set “js” controller , routed “global.js” “global” method of “js” controller, couldn’t use php dynamically add javascript “global.js” if i’m logged in admin? there better way cache pages if visitor not admin? i want show add/edit/delete links on page, if i'm logged in admin. want cache page. codeigniter's caching doesn't support conditional caching, needed workaround insert links dynamically. i'm using php dynamically write javascript can use jquery insert links. 1) set in /config/routes.php: $route['js/global.js'] = 'js/global_scripts'; // function can't called "global" since it's php keyword 2) have function in js controller: public function global_scripts() { $this->output->set_header("content-type: application/x-javascript") $this->load->view('js/global'); // see below } // global_scripts ...