[TYPO3-dev] Run TYPO3 in different Context: production, development, etc..

Fabien Udriot fabien.udriot at ecodev.ch
Wed Aug 1 12:03:20 CEST 2012


Hi Stefan,

Thanks for your snippet. One can also access the context info in TypoScript which could be useful
for instance for CSS / JS concatenation and minification according to the case. You could have this
code:

In your Constants:
---------------------

# Assuming Production is the default context
config.context = Production

[globalString = ENV:TYPO3_CONTEXT = Development]
	config.context = Development
[end]

In your Setup:
------------------

page.10.value = production

[globalString = LIT:Development = {$config.context}]
	page.10.value = development
[end]

Cheers,

Fb.

On 7/31/12 4:14 PM, Stefan Geith wrote:
> Am 31.07.2012 10:04, schrieb Fabien Udriot:
>> [...]
>> Typically, you would find in your htaccess:
>>
>>      SetEnv TYPO3_CONTEXT Production
>>
>> Connected somehow with the "context" issue, [...]
> 
> I often used this construct im my localconf.php
> with websites where I have a Life-, a Preview- and
> a Dev-Version:
> 
> if (!defined('TYPO3_CONTEXT')) {
>     if (getenv('TYPO3_CONTEXT')) {
>         define('TYPO3_CONTEXT', getenv('TYPO3_CONTEXT'));
>     } elseif (ini_get('TYPO3_ENV')) {
>         define('TYPO3_CONTEXT', ini_get('TYPO3_CONTEXT'));
>     } else {
>         define('TYPO3_CONTEXT', 'UNCONFIGURED');
>     }
> }
> 
> ...
> $TYPO3_CONF_VARS['SYS']['sitename'] = 'Sitename ('.TYPO3_CONTEXT.')';
> ...
> if (strcmp(TYPO3_CONTEXT,'www')==0) {
>         $typo_db_username = ...
>         $TYPO3_CONF_VARS['EXT']['extConf']['googleMapApiKey'] = ...
> } elseif (strcmp(TYPO3_CONTEXT,'preview')==0) {
>         $typo_db_username = ...
>         $TYPO3_CONF_VARS['EXT']['extConf']['googleMapApiKey'] = ...
> } elseif (strcmp(TYPO3_CONTEXT,'dev')==0) {
>         $typo_db_username = ...
>         $TYPO3_CONF_VARS['EXT']['extConf']['googleMapApiKey'] = ...
> }
> 
> So it would be great if Typo3 could react on some CONTEXT-Variables to use a specific typo3conf like
> e.g.
>        'LocalConfiguration' . TYPO3_CONTEXT. '.php'
> 
> 
> /Stefan
> 
> 
> 
> 



More information about the TYPO3-dev mailing list