Embedded CP CSS
Posted: 16 July 2004 08:56 AM   [ Ignore ]  
Summer Student
Total Posts:  29
Joined  05-16-2004

Why is the CSS embedded in the CP pages, instead of being linked to with a <LINK> or @import? Doesnt that seem like a waste of filesize?

Would this be due to masking the CP location?

Profile
 
 
Posted: 16 July 2004 10:22 PM   [ Ignore ]   [ # 1 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  7534
Joined  08-05-2002

Because we do not want any part of the Control Panel cached either by the program or the browser for various reasons (ability of users to change their CP theme for one), so putting it in a separate file saves nothing and might cause problems with browsers who happen to cache CSS files.

The CSS theme files are located in the system directory, so technically if someone is viewing the Control Panel they already know the location of that directory.

 Signature 
Profile
 
 
Posted: 17 July 2004 09:01 PM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  29
Joined  05-16-2004

The CP themes are stored in a different .css files. Wouldnt be hard to just change the <LINK> to them at the <HEAD>.  Just wondering why this was done, since caching the CSS files isn’t a problem if they are different files for different themes. No criticism really, just a thought! smile

Profile
 
 
Posted: 17 July 2004 09:37 PM   [ Ignore ]   [ # 3 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  7534
Joined  08-05-2002

If they are in files, caching is a problem if you ever update those CSS themes.  Let’s say you are using EE for running a business site, and you want to force the CP to have a different look to match the business’ look.  You delete all of the CSS theme files except one, the default.  Modify the default css file as you see fit.  If someone views the CP, the CSS file is updated after that first viewing, and they are using a browser which happens to cache the CSS file (IE 5 for Mac), then they will not see the changes.

And I just realized that there your question about masking the CP location is actually relevant in a certain situation, which also contributed to why we wrote the CSS into the page instead of a separate file.  In the /system/utilities/ directory you will find a file called admin.php.  You can put this file outside of the system directory (say at the base of your site) along with a path.php file, and then you can have the CP available outside the system directory.  Thus, certain members can use the CP, perhaps only for posting articles, and yet they will not have them know the location of the system directory.

I am fairly sure there is at least one more reason why we put the CSS into the page instead of a file, but I would have to think about it for a bit.

 Signature 
Profile
 
 
Posted: 18 July 2004 05:03 PM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  29
Joined  05-16-2004

preventing a browser from caching a CSS file is easy, whether it’s Mac or not.. just use default.css?mod1, default.css?mod2 etc, each time you modify it. quite simple.

and about masking, i suppose the admin.php could accept a parameter to output the CSS file such as <link href=“admin.php?stylesheet=default.css” etc..> and thus not compromise the location of the files.

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64905 Total Logged-in Users: 52
Total Topics: 81843 Total Anonymous Users: 31
Total Replies: 440034 Total Guests: 277
Total Posts: 521877    
Members ( View Memberlist )