Best way to utilise an include file which just includes an array in PHP
Posted
by alex
on Stack Overflow
See other posts from Stack Overflow
or by alex
Published on 2010-01-15T06:41:39Z
Indexed on
2010/03/16
16:11 UTC
Read the original article
Hit count: 157
Kohana's config files look like this.. here is an example of a database config file (simplified)
return array(
'dbhost' => 'localhost',
'user' => 'Tom_Jones'
);
I've also got a CMS which wants the connection details. Whilst the CMS uses a different user (with more rights), I'd like to know the best way to include this file and get the data out of it (so as to not repeat myself for hostname and dbname).
I haven't thought up of any elegant solutions yet and have not yet dug around Kohana to see how it does it. It's late Friday here so it's probably really obvious to everyone except me.
UPDATE
My apologies, I forgot to include that this is using Kohana 3!
© Stack Overflow or respective owner