Welcome Guest, Not a member yet? Register   Sign In
Telling the session class to go to sleep
#9

[eluser]CtheB[/eluser]
You really shouldn't autoload the session class (because the CI session class is very very slow)
And you really shouldn't handle the dynamic css like this (because that is also very slow, and you need to generate your css file every time again (ouch!) no caching possible :-S )

2 options:

1. You can route your application to 1 main controller wich handles the dynamic css in method x
2. You can extend controller.php with MY_Controller.php and here handle the dynamic css in method x.

With one of the two options make a new method wich does the following:

1. Look for the last update time of a dynamically generated combined css file.
2. Look for the last update time of all the included css files.
3. If at least 1 css file has a later update time then the combined file -> Generate the combined css file again.
4. In your <head> section of your template you can point to the combined file (wich you name something like styles_v16.css.php or whatever you like)

Some tips:

# If you generate the css file, include some headers, so PHP knows the file is a CSS file and set the expire date etc.
# You can make different versions of your combined css file like 1_2_3_4_5_8_11_14.css.php and 1_2_3_7_9_12_13.css.php
so you only need to include the css inside the file, what is needed for the current page.
# You can make a database table with all the css files or load them in an array inside your controllers so you can handle them afterwards in your main controller.
# Same situation is for all your JS files: combine them in 1 file dynamically!
# Good luck!


Messages In This Thread
Telling the session class to go to sleep - by El Forum - 12-09-2009, 04:02 AM
Telling the session class to go to sleep - by El Forum - 12-09-2009, 01:17 PM
Telling the session class to go to sleep - by El Forum - 12-09-2009, 01:40 PM
Telling the session class to go to sleep - by El Forum - 12-09-2009, 02:39 PM
Telling the session class to go to sleep - by El Forum - 12-09-2009, 03:12 PM
Telling the session class to go to sleep - by El Forum - 12-09-2009, 03:17 PM
Telling the session class to go to sleep - by El Forum - 12-09-2009, 03:20 PM
Telling the session class to go to sleep - by El Forum - 12-09-2009, 03:27 PM
Telling the session class to go to sleep - by El Forum - 12-09-2009, 04:25 PM
Telling the session class to go to sleep - by El Forum - 12-11-2009, 03:39 PM



Theme © iAndrew 2016 - Forum software by © MyBB