synapsestudios / kohana-notices

Notices module for Kohana 3.x
34 stars 6 forks source link

media controller? #4

Open samwilson opened 14 years ago

samwilson commented 14 years ago

I was wondering whether you would consider adding a media controller to this module, that would serve the media files? Akin to what is used in the userguide. Doing so would mean that one could include the module without having to do anything (i.e. copy any files anywhere), and so updates would be simpler.

Just an idea (because I want to use this module!).

Thanks!

jeremeamia commented 14 years ago

I would definitely consider that! There is a debate at the office on whether or not that is a good idea, but I personally would like this feature because it is much more convenient to use it that way. I will probably make it configurable, but with the media controller usage as default, that way it can be used "out of the box". I will probably add this feature sometime this week or this weekend. I'm glad you like the module.

zeelot commented 14 years ago

It's a very bad idea to use a media controller for this reason... the userguide would not be enabled on production sites so the performance impact is not as important. If anything... I would create a generic media module that tries to serve media from the kohana FS if the request makes it to kohana. Module makers would have to follow a convention for where they put media files and it would only matter if the user does not move the media to a public directory

jeremeamia commented 14 years ago

You are a party-pooper, Zeelot. How much a performance hit would it be? Has anyone ever determined this? The main issue is that you have to load the entire framework for every single asset. A single notice requires a css file, and image, and a javascript file. So that is a minimum of three requests every time. Would the browser cache it prevent the framework from loading after the first time? Either way, that still presents a problem in production.

Still, having this feature would reduce the initial setup time for using the module.

The problem with the media module is that no one wants to conform to a particular standard, though I certainly agree with you about the utility.

zeelot commented 14 years ago

well we at synapse can conform to a standard instead of creating a media controller for all our modules... as for the performance hit.. I never tested it but you can always notice even locally without running benchmarks... Kohana used to have a media controller before 2.3.x and they removed it because a) people were using it for the wrong reasons (this one) and b) it performed horribly

jeremeamia commented 14 years ago

LOL, yeah...

Well, I need to do something to make it easier to use out-of-the-box. I'll have to think about it.

samwilson commented 14 years ago

Okay, so perhaps it is not an efficient way of doing things. What about making it easier to symlink to the module's media directory, by placing it in a subdirectory of /media? As in /media/notices/css rather than /media/css. Then, in the application's media directory one could just add a symlink to /media/notices and all of the URLs within the module would work.