Welcome Guest, Not a member yet? Register   Sign In
Built in public assets mangment & URLs
#1

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 ;)
Reply
#2

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
Reply
#3

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.
Reply
#4

Thanks. Smile
Reply
#5

(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
Reply
#6

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

(This post was last modified: 11-09-2016, 08:12 AM by prezire.)

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.
Long live CodeIgniter!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB