Welcome Guest, Not a member yet? Register   Sign In
Numerous CSS and Scripts Loading in Every View
#21

[eluser]jdfwarrior[/eluser]
I wasn't saying to load the js/css in the controller. What I was saying was to, inside the controller, create an array of the files that should be loaded, and then in the view, have the loop load the necessary files. Or as suggested by someone else, run it through a function that combines the files, generates a dynamic file, pass that file name into the view from the controller, and have the view load it (generate the html).
#22

[eluser]Dam1an[/eluser]
Hmm... if you use the Google version and it can take a few seconds to respond, then its more reason to not load it before... I get bored after 2-3 seconds of waiting lol

It might just be better to do the initial load up front, and then it will stay in cache...
#23

[eluser]slowgary[/eluser]
You're right, it does make sense in a lot of ways. Still there are times when your user interface depends on the JS, so it really needs to be decided on a case by case basis. I'll continue to put mine in the head out of habit, plus I feel like it's better organized that way. But anyways, I could go on about this all day (and it's off topic ;-P)
#24

[eluser]Dregond Rahl[/eluser]
As suggested its best to just deliver the ones you need with a function or array of some sort, another method would be to compress the files and use caching methods more strongly. either case, the first load will be a bit slow but after that everything will work fine.

Although combining CSS or JS files on the fly using PHP would work, it may have some caching issues, such as storing the versions of the files which aren't right for the different pages, missing something here and there. if you make it dynamic, though it would cut down requests it would still need to load the JS and CSS each time, which would cancel things out..and would be a bit pointless.

But if you combine all the code on your own and load it up as a single JS or CSS file with caching and compressed that would cover everything. Only problem would be if there are any overriding attributes in the CSS =/
#25

[eluser]Dam1an[/eluser]
If you're really concerned about it, can out not host all the JS, CSS (and images) on another server (or same server, differant domain)
That'll let you handle more requests, and you can do the HTML and the CSS, JS and images simulataneously...

That failing, you could always do inline CSS and JS (That is not a real suggestion Tongue)
#26

[eluser]jdfwarrior[/eluser]
So wait... is inline css bad?? Oh noes! hehe
#27

[eluser]Dam1an[/eluser]
[quote author="jdfwarrior" date="1242782504"]So wait... is inline css bad?? Oh noes! hehe[/quote]

I hope (for your own sake) that you're joking

And I didn't mean inline in that sense, just all in the header block... yours is even worse Tongue
#28

[eluser]jdfwarrior[/eluser]
[quote author="Dam1an" date="1242782764"][quote author="jdfwarrior" date="1242782504"]So wait... is inline css bad?? Oh noes! hehe[/quote]

I hope (for your own sake) that you're joking

And I didn't mean inline in that sense, just all in the header block... yours is even worse Tongue[/quote]

Definitely kidding. Have ya not noticed my non serious manner around here? I tend to joke around a lot. Oh wait, nm, I forgot, my mean muggin avatar throws that all off so you couldn't tell Smile
#29

[eluser]Dam1an[/eluser]
I knew you where joking, but you seem to hve taken me seriously Tongue
(And don't you dare answer saying you was joking, but I took you seriously)
#30

[eluser]jdfwarrior[/eluser]
Gosh you take everything so literally.. lol




Theme © iAndrew 2016 - Forum software by © MyBB