CodeIgniter Forums
Built in public assets mangment & URLs - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forumdisplay.php?fid=29)
+--- Thread: Built in public assets mangment & URLs (/showthread.php?tid=66534)



Built in public assets mangment & URLs - Muaawiya - 11-01-2016

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 ;)


RE: Built in public assets mangment & URLs - jlp - 11-01-2016

https://bcit-ci.github.io/CodeIgniter4/concepts/structure.html#public

How you subdivide that, eg separate folders for CSS or Javascript, is up to the developer.


RE: Built in public assets mangment & URLs - PaulD - 11-01-2016

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.


RE: Built in public assets mangment & URLs - Muaawiya - 11-01-2016

Thanks. Smile


RE: Built in public assets mangment & URLs - Muaawiya - 11-01-2016

(11-01-2016, 01:31 PM)PaulD Wrote: 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.

I agree. Thanks


RE: Built in public assets mangment & URLs - Paradinight - 11-01-2016

(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.

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.

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.


RE: Built in public assets mangment & URLs - prezire - 11-07-2016

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'); ?>
once I push the HTML helper.

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.