Alexander
Alexander

Reputation: 20224

Include typo3 LocalConfiguration.php

How can I include typo3's LocalConfiguration.php into my script (which is NOT inside typo3)? Since that file returns an array:

<?php
return [
    'BE' => [
    ...

I thought I have to put the include into a function:

function getConf() {
    include_once("typo3conf/LocalConfiguration.php");
}
$conf = getConf();
print_r($conf);

but the output is empty.

Upvotes: 1

Views: 824

Answers (3)

jokumer
jokumer

Reputation: 2269

You should use $GLOBALS to read values from TYPO3 configuration, wich values are written/overwritten by these files in this order DefaultConfiguration + LocalConfiguration + AdditionalConfiguration

Upvotes: 0

Dimitri Lavren&#252;k
Dimitri Lavren&#252;k

Reputation: 4879

most likely you need to return the configuration:

<?php
function getConf() {
    return include_once("typo3conf/LocalConfiguration.php");
}
$conf = getConf();
print_r($conf);

René Pflamm's solution should be easier

Upvotes: 0

Ren&#233; Pflamm
Ren&#233; Pflamm

Reputation: 3354

Just inlcude it directly to the variable:

$conf = include 'typo3conf/LocalConfiguration.php';

Upvotes: 3

Related Questions