Marco, This is a good solution. So long as we do not stick externalThemeFile into a loop somewhere, there aren't too many extra disk lookups. If we start seeing a slow down, we can easily put in a caching system, to prevent the disk checks. Sameer On Sat, Dec 03, 2005 at 12:48:11PM +0100, Marco Bonetti wrote: > Date: Sat, 3 Dec 2005 12:48:11 +0100 > From: Marco Bonetti <mbonetti at gmail.com> > To: gregarius-dev at sinless.org > Subject: Re: [greg-dev] theme path > Reply-To: gregarius-dev at sinless.org > > Sameer, Marcus, > > I see the problem. What about the following solution: > > function externalThemeFile($filename, $template, $useDefault=true) { > > $actualTheme = config, theme_override, $_REQUEST['theme']... > if $actualTheme not defaultTheme { > if file_exist("$actualTheme/$filename") { > prtinf($template,"$actualTheme/$filename") > } > > if (!$useDefault) { > return; > } > } > prtinf($template,"$defaultTheme/$filename") > } > > > $temaplte could be something like <img src="%s" alt="xxx" /> or > <link rel="stylesheet" type="text/css" href="%s" /> > > In other words we'd apply exactly the same idea as the one used for > the templates to "external" files. > > The downside of the approach is obviously the extra disk access > required by file_exists() > > What do you guys think? > > -m > > > > > > > On 12/3/05, Marcus Kimpenhaus <marcus at kimpenhaus.de> wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > When you decide to do so, it would probably be good to extract the > > functionalty to a single method called by the others. > > > > I found references in: > > > > * admin/config.php > > > > <-- which is correct as it is - here the getConfig('rss.output.theme') > > is the default theme > > > > * cls/rss/rss.php > > * cls/wrappers/misc.php > > * init.php > > * plugins.php > > * util.php > > > > <-- all of those except util.php and misc.php (not atually ;-) ) do > > the same block of code for getting the actual theme. maybe this > > could then be extracted to new function. > > > > regards, > > marcus. > > > > - -- > > > > Marcus Kimpenhaus > > > > Polsumer Str. 56 > > 45896 Gelsenkirchen > > > > +49 (209) 9256075 > > marcus at kimpenhaus.de > > > > - -- > > > > Sameer D'Costa schrieb: > > > Hi Marcus, > > > > > > Personally I am of the opinion that we should implement something like > > > your patch. When we append a ?theme=newtheme url to a gregarius URL I > > > would like to see the new theme take over completely. > > > > > > Currently the theme overriding is only partial. You get the newtheme's > > > layout but not the css files or the images if you use the cls wrapper > > > functions. > > > > > > The advantage we have with the current method is as follows... > > > If you create a newtheme with just an index.php file in it and some css > > > files in it then adding ?theme=newtheme to the gregarius url will work. > > > The nice thing about this, is that you have to do almost no work to keep > > > your theme up2date. I have reduced the lilina theme to just 4 files and > > > it quite easy to make sure that it works on 0.5.2 and 0.5.3+. I have done > > > something similar for the crystal theme but I haven't released the new > > > version yet. > > > > > > The advantage to the Marcus' patch is that we can switch a theme > > > completely by putting its name in _REQUEST['theme']. I think we should go > > > with this method even though it means that theme authors will have a > > > little more work to do to keep their themes up2date. Maybe release > > > different versions for different versions of Gregarius. > > > > > > Marco, this is all related to the questions I was going to ask you :) > > > What do you think? > > > > > > Sameer > > > > > > > > > > > > On Sat, Dec 03, 2005 at 12:54:59AM +0100, Marcus Kimpenhaus wrote: > > > > > > > > >>Date: Sat, 03 Dec 2005 00:54:59 +0100 > > >>From: Marcus Kimpenhaus <marcus at kimpenhaus.de> > > >>To: gregarius-dev at sinless.org > > >>Subject: [greg-dev] theme path > > >>Reply-To: marcus at kimpenhaus.de, gregarius-dev at sinless.org > > >> > > > Hi, > > > > > > sorry for being absent for such a long time - but I got a lot things to > > > for work :-/ > > > > > > I've tried to accomplish a port of the theme switcher plugin known from > > > wordpress and stumbled over the function 'rss_theme_path' in the > > > misc.php wrapper wondering why this wrapper is the only function which > > > is not the $_REQUEST['theme'] part implementing. > > > > > > I'm not sure - but after patching it to that - the theme switcher was > > > working for me. > > > > > > I've attached the diff - maybe someone can tell me if it works as it should. > > > > > > I will also publish the theme switcher - which only works with this > > > patch - if you agree with the diff. It is in an early state and could be > > > enhanced for sure. But true to software devlopment - release early and > > > often ;-) > > > > > > regards, > > > marcus > > > > > > > Index: cls/wrappers/misc.php > > =================================================================== > > - --- cls/wrappers/misc.php (Revision 1052) > > +++ cls/wrappers/misc.php (Arbeitskopie) > > @@ -27,12 +27,20 @@ > > > > > > ///// MISC WRAPPERS ///// > > - -function rss_theme_path() { > > +function rss_theme_path() > > +{ > > $theme = getConfig('rss.output.theme'); > > - - if (defined('THEME_OVERRIDE')) { > > + > > + if (defined('THEME_OVERRIDE')) > > + { > > $theme = THEME_OVERRIDE; > > } > > - - return getPath(). RSS_THEME_DIR."/$theme"; > > + elseif (isset($_REQUEST['theme'])) > > + { > > + $theme = preg_replace('/[^a-zA-Z0-9_]/','',$_REQUEST['theme']); > > + } > > + > > + return getPath(). RSS_THEME_DIR."/$theme"; > > } > > > > - -?> > > \ No newline at end of file > > +?> > > > > > > _______________________________________________ > > gregarius-dev mailing list > > gregarius-dev at sinless.org > > http://sinless.org/mailman/listinfo/gregarius-dev > > > > > > -----BEGIN PGP SIGNATURE----- > > Version: GnuPG v1.4.2 (MingW32) > > Comment: GnuPT-Light 0.4 > > Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org > > > > iD8DBQFDkWMGRuI7h7b3Yu8RAiLDAKCmslU+/7creuaW5QmhUQUzwiJjmQCgjwpJ > > rleKMbdKzRFjLyo6m+pjhyw= > > =x0uG > > -----END PGP SIGNATURE----- > > _______________________________________________ > > gregarius-dev mailing list > > gregarius-dev at sinless.org > > http://sinless.org/mailman/listinfo/gregarius-dev > > > > _______________________________________________ > gregarius-dev mailing list > gregarius-dev at sinless.org > http://sinless.org/mailman/listinfo/gregarius-dev