From 1f56ff5407fcbee3037e449a1b96261ab483aac9 Mon Sep 17 00:00:00 2001 From: Jeroen van Riet Paap Date: Mon, 7 Mar 2016 17:07:34 +0100 Subject: Update DerivedTheme1.md --- doc/DerivedTheme1.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'doc/DerivedTheme1.md') diff --git a/doc/DerivedTheme1.md b/doc/DerivedTheme1.md index 805d6b614..23f2916a4 100644 --- a/doc/DerivedTheme1.md +++ b/doc/DerivedTheme1.md @@ -63,7 +63,6 @@ In it, put the following: That's it. This tells the software to read the PCSS information for the redbasic theme first, and then read our CSS file which will just consist of changes we want to make from our parent theme (redbasic). - Now create the actual CSS file for your theme. Put it in view/theme/mytheme/css/style.css (where we just told the software to look for it). For our example, we'll just change the body background color so you can see that it works. You can use any CSS you'd like. @@ -74,4 +73,29 @@ Now create the actual CSS file for your theme. Put it in view/theme/mytheme/css You've just successfully created a derived theme. This needs to be enabled in the admin "themes" panel, and then anybody on the site can use it by selecting it in Settings->Display Settings as their default theme. +**Lesson 2** + +If you want to use the redbasic schemas for your derived theme, you have to do a bit more. + +Do everything as above, but don't create view/theme/mytheme/php/style.php, but copy instead view/theme/redbasic/php/style.php to view/theme/mytheme/php/style.php. Modify that file and remove (or comment out) these two lines: + + if($a->channel['channel_theme'] != 'redbasic') + set_pconfig(local_channel(), 'redbasic', 'schema', '---'); + +Also add this line at the bottom: + + echo @file_get_contents('view/theme/mytheme/css/style.css'); + +To show the schema selector you have to copy view/theme/redbasic/tpl/theme_settings.tpl to view/theme/mytheme/tpl/theme_settings.tpl. Modify that file and replace the lines: + + {{if $theme == redbasic}} + {{include file="field_select.tpl" field=$schema}} + {{/if}} + +with: + + {{include file="field_select.tpl" field=$schema}} + + + #include doc/macros/main_footer.bb; -- cgit v1.2.3 From bb09b8a38546538c28f7f3d0aa0d6e5506210c37 Mon Sep 17 00:00:00 2001 From: jeroenpraat Date: Wed, 9 Mar 2016 23:25:37 +0100 Subject: Update doc --- doc/DerivedTheme1.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc/DerivedTheme1.md') diff --git a/doc/DerivedTheme1.md b/doc/DerivedTheme1.md index 23f2916a4..3db86b6e7 100644 --- a/doc/DerivedTheme1.md +++ b/doc/DerivedTheme1.md @@ -79,8 +79,8 @@ If you want to use the redbasic schemas for your derived theme, you have to do a Do everything as above, but don't create view/theme/mytheme/php/style.php, but copy instead view/theme/redbasic/php/style.php to view/theme/mytheme/php/style.php. Modify that file and remove (or comment out) these two lines: - if($a->channel['channel_theme'] != 'redbasic') - set_pconfig(local_channel(), 'redbasic', 'schema', '---'); + if(local_channel() && $a->channel && $a->channel['channel_theme'] != 'redbasic') + set_pconfig(local_channel(), 'redbasic', 'schema', '---'); Also add this line at the bottom: -- cgit v1.2.3 From 9abd95fad3784a10fc48bc40f9b8a75d7d74edda Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 31 Mar 2016 16:06:03 -0700 Subject: static App --- doc/DerivedTheme1.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc/DerivedTheme1.md') diff --git a/doc/DerivedTheme1.md b/doc/DerivedTheme1.md index 3db86b6e7..b120c628c 100644 --- a/doc/DerivedTheme1.md +++ b/doc/DerivedTheme1.md @@ -38,7 +38,7 @@ Inside it, put the following information - edit as needed function mytheme_init(&$a) { - $a->theme_info['extends'] = 'redbasic'; + App::$theme_info['extends'] = 'redbasic'; } @@ -79,7 +79,7 @@ If you want to use the redbasic schemas for your derived theme, you have to do a Do everything as above, but don't create view/theme/mytheme/php/style.php, but copy instead view/theme/redbasic/php/style.php to view/theme/mytheme/php/style.php. Modify that file and remove (or comment out) these two lines: - if(local_channel() && $a->channel && $a->channel['channel_theme'] != 'redbasic') + if(local_channel() && App::$channel && App::$channel['channel_theme'] != 'redbasic') set_pconfig(local_channel(), 'redbasic', 'schema', '---'); Also add this line at the bottom: -- cgit v1.2.3