Built in public assets mangment & URLs |
I would like to have built in directory structure for publicly exposed assets like CSS/JS/Images/Fonts etc and key press URL function or variable to link these directories since it's very headache at least for me ;)
https://bcit-ci.github.io/CodeIgniter4/c...tml#public
How you subdivide that, eg separate folders for CSS or Javascript, is up to the developer.
James Parry
Project Lead
I have to say, that although I understand why you might be thinking that such a structure would be useful, you would soon find that any 'built in' asset structures would soon become a walled garden as opposed to an open world.
As soon as you get to any complexity of including and using external assets, any such structure would immediately become something to work around, rather than work with. One of the wonderful things about CodeIgniter is it's inherent flexibility and lack of any dictatorial rules so common place in other frameworks. So I would have to disagree with your implied assertion that such an asset structure would be beneficial in any way. Sorry. Paul.
(11-01-2016, 01:31 PM)PaulD Wrote: I have to say, that although I understand why you might be thinking that such a structure would be useful, you would soon find that any 'built in' asset structures would soon become a walled garden as opposed to an open world. My asset structure is: - assets/js - assets/css - assets/images - assets/plugins Plugin folder example: - assets/plugins/bootstrap-3.3.7 - assets/plugins/font-awesome-4.7.0 etc. The download/upload folder is in the public folder or above the public.
Structure it like: {project}/public/images/some-asset.png.
Access it like: PHP Code: <?php echo base_url('images/some-asset.png'); ?> There's soon going to be PHP Code: <?php echo img('images/some-asset.png'); ?> Note: File listing is disabled. Accessing only via folder name thru browser will throw an error. So you should access the file directly using its filename.
Long live CodeIgniter!
|
Welcome Guest, Not a member yet? Register Sign In |