[dev] Themes changes

Michael M Slusarz slusarz at horde.org
Tue Nov 23 08:16:12 UTC 2010


Just a quick note to explain some of the theme changes I have just made.

#1: No file should EVER directly live under the themes directory  
anymore.  All of the default files/graphics should live under the  
aptly-named 'default' directory.

Why the change?
* Now it makes it trivial to create a theme.  You just have to copy  
the default directory to a new directory and edit the new directory.
* The old setup was confusing - in the base level, what were the  
default elements and what were theme files?
* Limited the sub views we could use due to name conflicts with  
existing themes (there can now be a mobile theme, while individual  
apps can define mobile subviews, and there is no longer conflict).
* Vastly simplifies our parsing code; don't need special case to look  
at base directory since we treat default files as just another theme.

#2: Themes caching.  Yay.  Had discussions months ago when I  
originally altered the theme structure, and finally got around to it.

Works by caching the file existence of theme files for each of the following:

Horde app, 'default' theme
Horde app, theme
[If current app is not horde]:
App, 'default' theme
App, theme

Thus, there is a cache entry for, e.g., 'imp with the silver theme'.   
On subsequent runs, there is no reason to do file existence checks -  
we just check the bit masks of the cached data to determine which  
image/sound/css file to display.  A quick benchmark on a random page  
in IMP was showing 330+ file_exists() calls per page load.  This has  
now gone down to 0.

Outside of theme development, there is no reason caching should not be  
used.  To aid theme development, still need to add an option to  
disable theme caching and a command-line script that will clear all  
theme cache data.

#3: In the future, we should make absolutely sure that we only use  
Horde_Themes methods to create CSS, Images, and Sound links.  (In the  
same boat, all javascript should be loaded via the javascript helper  
methods located in horde/Core).  We are reaching the point that if you  
don't think you can do something via Horde_Themes, then you are most  
certainly Doing It Wrong.

michael

-- 
___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the dev mailing list