Dynamic Assets. Am I doing this right? |
[eluser]Unknown[/eluser]
For the application I'm writing, I need to be able to have css and javascript files that can be processed by php. The files live in application/assets/{js,css} I ended up writing this route: Code: $route['assets/([^/]+)/(.*)'] = 'assets/load/$1/$2'; and this controller in application/controllers/assets.php: Code: <?php defined('BASEPATH') or exit('No direct script access allowed'); Now I can access application/assets/css/site/test.css.php in my browser at http://localhost/ci/index.php/assets/css/site/test.css with no issue. What I am wonder is if I reinvented the wheel on this one, or if there is a "best practice" to follow for this sort of thing. |
Welcome Guest, Not a member yet? Register Sign In |