Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Theme instance merge custom config
  • Hi Harro,

    In the __construct function of Theme class, if $config is not empty, why you don't merge it with theme.php config file (\Config::load('theme')) ?

    I ask that because in my app i use .twig extension for theme views, but imagine i load a module which use theme class with .php extension for views.

    The module controller need to do :
    $this->theme = \Theme::instance('', array('view_ext' => '.php', 'use_module' => true));

    It's ok.

    But now active theme is "default", because it's set in the Theme class by default. Counter to i have set in my app the active theme to "mobile". I have now error with "default" theme not found.. 
  • I've an alternative : 

            \Config::load('theme', true, false, true);
            $config = \Config::get('theme');
            $config['view_ext'] = '.php';
            $this->theme = \Theme::instance('', $config);

    But i always don't understand why you merge with the private $config var in Theme class, instead of the the config file
  • If you think this is a bug, can you create an issue for it at https://github.com/fuel/core/issues ?
  • I think is your choice, look at http://fuelphp.com/docs/classes/theme/methods.html#/method_forge

    "If no configuration is passed, the configuration is loaded from the global configuration file. Note that if you pass a partial configuration, it will be merged with the defaults shown in the introductionNOT with the defaults in your configuration file!"

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion