Project

General

Profile

Feature #7328

theme_backup and default_template settings in configuration.php

Added by Julio Montoya almost 5 years ago. Updated over 4 years ago.

Status:
Feature implemented
Priority:
Normal
Assignee:
Category:
Styles, Layout & Accessibility
Target version:
Start date:
14/10/2014
Due date:
% Done:

100%

Estimated time:
Spent time:
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

Revision 2db9057d (diff)
Added by Julio Montoya over 4 years ago

Adding theme_backup and default_template settings see #7328

Blocks added in templates in order to be overwrite.

Revision 5aa26b90 (diff)
Added by Yannick Warnier over 4 years ago

Fix issue with default template at install time - refs #7328

History

#1

Updated by Julio Montoya almost 5 years ago

  • Status changed from New to Assigned
  • Assignee set to Julio Montoya
#2

Updated by Julio Montoya over 4 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)
#4

Updated by Yannick Warnier over 4 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.

#5

Updated by Yannick Warnier over 4 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';
    }
...

Also available in: Atom PDF