Feature #7328
theme_backup and default_template settings in configuration.php
Status:
Feature implemented
Priority:
Normal
Assignee:
Category:
Styles, Layout & Accessibility
Target version:
Complexity:
Normal
SCRUM pts - complexity:
?
Description
// If the database is down this style will be used to show the errors. $_configuration['theme_backup'] = 'chamilo'; // (main/css/chamilo) // The default template that will be use in the system. $_configuration['default_template'] = 'default'; // (main/template/default)
Associated revisions
Fix issue with default template at install time - refs #7328
History
Updated by Julio Montoya over 5 years ago
- Status changed from New to Assigned
- Assignee set to Julio Montoya
Updated by Julio Montoya over 5 years ago
- Subject changed from style_backup and default_template settings in configuration.php to theme_backup and default_template settings in configuration.php
- Description updated (diff)
Updated by Julio Montoya over 5 years ago
- Status changed from Assigned to Needs testing
- Assignee deleted (
Julio Montoya)
Updated by Yannick Warnier over 5 years ago
- Category set to Styles, Layout & Accessibility
- Status changed from Needs testing to Feature implemented
- Assignee set to Julio Montoya
- % Done changed from 0 to 100
Testing procedure:
- connecting to my local portal
- setting CSS theme to (local) "ulim" (orange)
- shutting down the database
- refreshing -> the CSS style that appears is the one from the default Chamilo config (blue)
- setting $_configuration['theme_fallback'] = 'ulim'; in main/inc/conf/configuration.php
- refreshing (still with the db shutdown) -> the ulim style appears
All good for the the theme_fallback.
Now for the template...- I connect to the main/admin/index.php page (which I know isn't supported in the "experimental" template)
- All good so far
- I set $_configuration['default_template'] = 'experimental'; in my configuration.php
- I reload the page -> white screen.
The following errors appear (which is good in this case as it indicates the system is trying to use the experimental template):[Thu Oct 16 16:54:28.203143 2014] [:error] [pid 11683] [client 127.0.0.1:38643] PHP Fatal error: Uncaught exception 'Twig_Error_Loader' with message 'Unable to find template "experimental/admin/settings_index.tpl" (looked into: /var/www/chamilo19x/main/template, /var/www/chamilo19x/plugin).' in /var/www/chamilo19x/vendor/twig/twig/lib/Twig/Loader/Filesystem.php:191\nStack trace:\n#0 /var/www/chamilo19x/vendor/twig/twig/lib/Twig/Loader/Filesystem.php(138): Twig_Loader_Filesystem->findTemplate('experimental/ad...')\n#1 /var/www/chamilo19x/vendor/twig/twig/lib/Twig/Environment.php(265): Twig_Loader_Filesystem->getCacheKey('experimental/ad...')\n#2 /var/www/chamilo19x/vendor/twig/twig/lib/Twig/Environment.php(323): Twig_Environment->getTemplateClass('experimental/ad...', NULL)\n#3 /var/www/chamilo19x/main/inc/lib/template.lib.php(946): Twig_Environment->loadTemplate('experimental/ad...')\n#4 /var/www/chamilo19x/main/admin/index.php(341): Template->fetch('experimental/ad...')\n#5 {main}\n thrown in /var/www/chamilo19x/vendor/twig/twig/lib/Twig/Loader/Filesystem.php on line 191, referer: http://my.chamilo19.net/user_portal.php
Nice! Well done. Good for me (and I was the requester). Closing.
Updated by Yannick Warnier over 5 years ago
Adding to this one because when installing a fresh Chamilo, I get this:
Fatal error: Class 'Template' not found in /var/www/chamilo19x/main/inc/global_error_message.inc.php on line 53
This comes from the fact that, at line 53 of global_error_message.inc.php, we are loading the Template class, which has not been defined yet (because we didn't load the normal basic dependencies).
if (is_int($global_error_code) && $global_error_code > 0) {
$theme = Template::getThemeFallback().'/';
$css_path = 'main/css/';
...
I'm doing a quick fix to this, but maybe there is a better way?
if (is_int($global_error_code) && $global_error_code > 0) {
if (class_exists('Template')) {
$theme = Template::getThemeFallback().'/';
} else {
$theme = 'chamilo';
}
...
Adding theme_backup and default_template settings see #7328
Blocks added in templates in order to be overwrite.