Loader extension - JavaScript and CSS loading functionality |
[eluser]Marfo[/eluser]
Hi! This is my first CI extension/library whatever, so behave . Usage: Controller Code: $this->load->set_script_path('js/'); view/welcome_message Code: echo $loader_scripts; Or in the controller: Code: $data['scripts'] = $this->output('scripts'); Useful or crap?
[eluser]Phil Sturgeon[/eluser]
This seems pretty confusing: Code: $this->output('scripts/css'); I would prefer: Code: $this->output('scripts', 'css'); Otherwise it looks like you are writing a path. Also, shouldn't the following be in a config file? Code: $this->load->set_script_path('js/'); Good stuff though mate, not seen anyone put this asset handling into the loader before. It's an interesting angle on a library-heavy problem.
[eluser]Marfo[/eluser]
[quote author="Phil Sturgeon" date="1258137598"]This seems pretty confusing: Code: $this->output('scripts/css'); I would prefer: Code: $this->output('scripts', 'css'); Maybe I could explain that better: Code: $this->load->output('script'); //Returns only scripts I used the slash so that I didn't have to repeat the code so many times :red: . [quote author="Phil Sturgeon" date="1258137598"] Also, shouldn't the following be in a config file? Code: $this->load->set_script_path('js/'); It could also be in a config file, but I want to be able to change the path in between. Code: $this->load->set_script_path('js/'); Thanks for the feedback mate
[eluser]Phil Sturgeon[/eluser]
I guess that may be a feature you intended, but it would be great having the default in a config file so it wouldn't need to be set globally in a MY_Controller or repeated a whole bunch of times in your controllers.
[eluser]Marfo[/eluser]
Update with the config option . Config file included.
[eluser]Zack Kitzmiller[/eluser]
I sort of took my own stab at this. http://ellislab.com/forums/viewthread/137755/ |
Welcome Guest, Not a member yet? Register Sign In |