[theme-reviewers] Why themes should not use fopen?
satish.iitg at gmail.com
Wed May 18 15:44:18 UTC 2011
I followed the discussion on use of open that happened before,and read this
I'm not convinced whats suggested there as the best way is the best way.
*Method 1: Insert the dynamic CSS directly into the HTML using the wp_head
*Method 1 has the lowest server impact. When you make the call to get*
*the page, it creates the page and outputs all the dynamic stuff in one*
*shot. Some people find the CSS in the html to be aesthetically*
*displeasing, but the fact of the matter is that this is the fastest,*
*simplest, and best way to do it.*
How the server impact is the lowest? CSS has to be generated dynamically
every time the page is loaded. Bandwidth is wasted as the CSS cannot be
If we go by method two described below, CSS is generated only when the theme
options are changed and then its just loading the static file, that can be
cached by the browser.
My theme allows user to customize every element of the site and some styles
are loaded only when the user enables a particular option.
So, my dynamic CSS is around 30kb on average.
In what way the above method is the BEST?
When thousands are users are going to use my theme, I'm willing to spend
extra time to offer the best solution rather than some simple and quick
*Method 2: Write dynamic CSS to a file, link to the file in the head.*
*Method 2 has a problem in that you're doing file writing from the*
*theme. This is bad because you cannot guarantee that you have*
*permissions to even write files. Assuming you try to write them to the*
*uploads folder, then part of your theme is now outside the theme*
*directory, which is confusing. Also, by including the CSS as a*
*separate file, you're creating another call to the server, which even*
*Google Webmaster Tools will tell you is a thing to avoid.*
Whats wrong with having a theme file outside the theme folder?
What is confusing and Confusing to whom?
An extra http request if far better than adding 30kb of weight to every
page. Also considering the number of images loaded by theme and the number
of stylesheets loaded the by plugins, the ONE additional http request is
Who told you they are confused?
There are 2500+ users on my theme support forum, and none of them ever had
problems with the stylesheet located in uploads folder.
PS: I'm pretty sure that I wont win this like all arguments, but I couldn't
of the blog owner and the reader.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the theme-reviewers