[TYPO3-english] Accessing extension constant from php script

Jackie Stallard jstallard at internode.on.net
Mon Aug 22 04:41:12 CEST 2011


Thanks Sergey but I'm already doing that (sorry should have said that!)

This is the relevant code:

<?php
require_once(PATH_tslib.'class.tslib_pibase.php');

class tx_austcommerge_pi5 extends tslib_pibase {
         var $prefixId      = 'tx_austcommerge_pi5';             // Same 
as class name
         var $scriptRelPath = 'pi5/class.tx_austcommerge_pi5.php'; 
  // Path to this script relative to the extension dir.
         var $extKey        = 'austcom_merge';   // The extension key.

     function main($content,$conf)   {
                 $this->conf=$conf;
                 $this->pi_setPiVarDefaults();
                 $this->pi_loadLL();
                 $this->pi_USER_INT_obj=1;       // Configuring so 
caching is not expected.

 
$confArray=unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['$this->extKey']);

debug($confArray);
debug($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']);

The first debug statement just displays 'debug'.
The second lists some of the other installed extensions but not 
austcom_merge.

On 22/08/2011 11:55 AM,     Sergey Alexandrov wrote:
> unserialize it first :)
>
> Thank you,
> Sergey
>
> Sent from my iPhone
>
> On Aug 21, 2011, at 9:35 PM, Jackie Stallard<jstallard at internode.on.net>  wrote:
>
>> I've created an extension constant in ext_conf_template.txt and I can see it from the extension manager.
>>
>> According to the documentation I should be able to access the constant in my PHP script as follows:
>> $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['austcom_merge']['austcom_mergeDb']
>> (where austcom_merge is the name of my extension and austcom_mergeDb is my constant.)
>>
>> But there is no 'austcom_merge' tree in $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']. Other extensions are listed - but not austcom_merge.
>>
>> Have I missed a step?
>>
>> I've also tried placing the constant in ext_localconf.php as follows:
>> $TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['austcom_mergeDb'] = 'newprojman';
>> Again, there is no 'austcom_merge' tree under $TYPO3_CONF_VARS['EXTCONF']
>>
>> Can anyone help?
>> Thanks
>>
>> Jackie
>> _______________________________________________
>> TYPO3-english mailing list
>> TYPO3-english at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english



More information about the TYPO3-english mailing list