Hi all, guys !
I need a bit help from developers about how to do this :
A plugin of mine displays a table in his admin panel. Odd and even rows are colorized differently by using a personal css file and all works fine. But i use mostly the dark admin theme and the colors I chose match with it but absolutly not with the clear theme.
Is it a way to "detect" the admin theme used and make a "switch" in my css file ?
Hope I'm clear enough ;-)
Thx !
Offline
It's OK, I got it !
For information, here is how to do :
1- Detecting the theme used:
$themeconf=$template->get_template_vars('themeconf'); $My_Var_theme=$themeconf['id'];
2- Telling to template the theme detected:
$template->assign( array( 'MY_VAR_THEME' => $My_Var_theme, ) );
3- In template file, combine css files according to theme detection:
{combine_css path= $path_to_my_css|@cat:'admin/template/my.css'} {if $MY_VAR_THEME=='clear'}{combine_css path= $path_to_my_css|@cat:'admin/template/themes/clear/theme.css'}{/if} {if $MY_VAR_THEME=='roma'}{combine_css path= $path_to_my_css|@cat:'admin/template/themes/roma/theme.css'}{/if}
4- And finally modifiyng the ./themes/*roma or clear*/theme.css files to display the good colors.
Hope it helps ! ;-)
Last edited by Eric (2014-01-24 19:32:59)
Offline
the var should always be available in $themeconf.id (always given to Smarty)
the value can't be "default", only "roma" or "clear"
Offline
mistic100 wrote:
the var should always be available in $themeconf.id (always given to Smarty)
Yes, I forgot it and remembered after posting here ;-)
mistic100 wrote:
the value can't be "default", only "roma" or "clear"
You are right. I fixed my previous posted code. Thx !
Offline