-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Marco, Hi Sameer, I've updated to the current svn-trunk revision and checked the theme-switcher plugin. It worked as suggested. Am I right that there are 2 changes: 1. getActualTheme - which gives the actual theme (ok - given by method name ;-) ) in order by $_REQUEST['theme'], theme_override, config 2. externalThemeFile - which gives the possibilty in themes not to override default theme-files Another question I've got - is there a possibilty to get the 'siteurl' - which is the root-url of gregarius e.g.: rss.foo-bar.net or www.foo-bar.net/rss regards, marcus. Marcus Kimpenhaus Polsumer Str. 56 45896 Gelsenkirchen +49 (209) 9256075 marcus at kimpenhaus.de Marco Bonetti schrieb: > 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: > > 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 > > _______________________________________________ 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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (MingW32) Comment: GnuPT-Light 0.4 Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDld//RuI7h7b3Yu8RAuxCAJ9SC5VwBYa5Hy/2OUP3kEGKZFj4xgCdGmtA 5kt8ODKPS9lnYWUl65Y8NvI= =jaOg -----END PGP SIGNATURE-----