Welcome Guest, Not a member yet? Register   Sign In
WOrking with custom config files
#11

[eluser]CroNiX[/eluser]
I'd steer clear of extremely common names that CI uses like "config", seeing as how CI uses a lot of things named "config" which is probably why you had a problem. Just like I wouldn't name a controller, "controller". Be creative with your names. 'template_config.php' or something.

Config gets instantiated early on in the bootstrap process, so a lot of CI classes/methods aren't available to it. If you want to see if a directory exists, you just have to use regular php to check it and probably not some CI way.
Code:
if (is_dir('/path/to/your/dir'))
{
  $config['defaultTemplate'] = 'something';
}
else
{
  $config['defaultTemplate'] = 'something_else';
}
#12

[eluser]xtremer360[/eluser]
Here's the only problem I can forsee with the suggested code from CroNix which is nice by the way is that I also use the modular system by wiredesignz and have a application/views/peach or any other template folders AND application/modules/views/peach or any other template folders
#13

[eluser]CroNiX[/eluser]
so check
Code:
APPPATH . 'views/peach';
and
Code:
APPPATH . 'modules/views/peach';
?
Not sure why that would be a problem?
#14

[eluser]weboap[/eluser]
then it will be always useful to have a default template set. to fall back to if your 'peach' (or whatever the user choose in the config file...)template doesn't exist . that way your site doesn't....
#15

[eluser]xtremer360[/eluser]
right as that was my intention. Thanks to ChroNiX for the code suggestion.




Theme © iAndrew 2016 - Forum software by © MyBB