Markus Klein wrote:
includeLibs
is loaded after the userFunc
is called, hence this will result in FALSE due to the function not being defined at all.
You need to define the userFunc
in a place, which is loaded before the TypoScript is executed.
Thanks for the hint, I just commented out the includeLibs line in the main typoscript template, which is where my code above comes from.
You were right, condition.php
ist already required by ext_localconf.php
of the extension. Which is loaded before the typoscript setup is executed, as "static template files are always included before this template" (per the last option on tab "Enthält").
user_rgnewsimg
reads only one argument. Still, the funny effect we 're talking about exists.
I'm not able to reproduce your error though.
Well, I can reproduce it, i just don't understand why. :-)
[1] http://docs.typo3.org/typo3cms/TyposcriptReference/Conditions/Reference/Index.html#id70
I do think I've grasped this.
Maybe I should post the complete error trace:
Uncaught TYPO3 Exception
#1: PHP Warning: Missing argument 1 for user_rgnewsimg() in /srv/www/vhosts/kluetz/httpdocs/typo3conf/ext/rgnewsimg/condition.php line 31 (More information)
TYPO3\CMS\Core\Error\Exception thrown in file
/srv/www/sources/typo3_src-6.2.12/typo3/sysext/core/Classes/Error/ErrorHandler.php in line 101.
11 TYPO3\CMS\Core\Error\ErrorHandler::handleError(2, "Missing argument 1 for user_rgnewsimg()", "/srv/www/vhosts/kluetz/httpdocs/typo3conf/ext/rgnewsimg/condition.php", 31, array)
/srv/www/vhosts/site1/httpdocs/typo3conf/ext/rgnewsimg/condition.php:
00029: */
00030:
00031: function user_rgnewsimg($cmd) {
00032:
00033: $vars = t3lib_div::_GET('tx_ttnews');
10 user_rgnewsimg()
9 call_user_func_array("user_rgnewsimg", array)
/srv/www/sources/typo3_src-6.2.12/typo3/sysext/core/Classes/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcher.php:
00409: $funcName = $matches[1][0];
00410: $funcValues = $matches[2][0] ? $this->parseUserFuncArguments($matches[2][0]) : array();
00411: if (is_callable($funcName) && call_user_func_array($funcName, $funcValues)) {
00412: return TRUE;
00413: }
8 TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher::evaluateConditionCommon("userFunc", "user_rgnewsimg(0)")
/srv/www/sources/typo3_src-6.2.12/typo3/sysext/frontend/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcher.php:
00033: protected function evaluateCondition($string) {
00034: list($key, $value) = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('=', $string, FALSE, 2);
00035: $result = parent::evaluateConditionCommon($key, $value);
00036: if (is_bool($result)) {
00037: return $result;
7 TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher::evaluateCondition("userFunc = user_rgnewsimg(0)")
/srv/www/sources/typo3_src-6.2.12/typo3/sysext/core/Classes/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcher.php:
00172: $andParts = explode(']&&[', $orPart);
00173: foreach ($andParts as $andPart) {
00174: $result = $this->evaluateCondition($andPart);
00175: // If condition in AND context fails, the whole block is FALSE:
00176: if ($result === FALSE) {
6 TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher::match("[userFunc = user_rgnewsimg(0)]")
/srv/www/sources/typo3_src-6.2.12/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php:
00233: $this->sections[md5($pre)] = $pre;
00234: }
00235: if (is_object($matchObj) && $matchObj->match($pre) || $this->syntaxHighLight) {
00236: if ($specificSection) {
00237: $this->sectionsMatch[md5($pre)] = $pre;
5 TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::parse("↵[GLOBAL]↵↵↵[GLOBAL]↵#############################…5127352673445009204" rel="publisher">Google+</a> ", TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher)
/srv/www/sources/typo3_src-6.2.12/typo3/sysext/core/Classes/TypoScript/TemplateService.php:
00997: }
00998: // Finally parse the Setup field TypoScript code (where constants are now substituted)
00999: $config->parse($all, $matchObj);
01000: // Read out parse errors if any
01001: $this->parserErrors['config'] = $config->errors;
4 TYPO3\CMS\Core\TypoScript\TemplateService::generateConfig()
/srv/www/sources/typo3_src-6.2.12/typo3/sysext/core/Classes/TypoScript/TemplateService.php:
00496:
00497: // Make configuration
00498: $this->generateConfig();
00499: // This stores the template hash thing
00500: $cc = array();
3 TYPO3\CMS\Core\TypoScript\TemplateService::start(array)
/srv/www/sources/typo3_src-6.2.12/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php:
02559: $this->tmpl->forceTemplateParsing = $this->forceTemplateParsing;
02560: // Start parsing the TS template. Might return cached version.
02561: $this->tmpl->start($this->rootLine);
02562: $GLOBALS['TT']->pull();
02563: if ($this->tmpl->loaded) {
2 TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::getConfigArray()
/srv/www/sources/typo3_src-6.2.12/typo3/sysext/cms/tslib/index_ts.php:
00171: // Get config if not already gotten
00172: // After this, we should have a valid config-array ready
00173: $TSFE->getConfigArray();
00174: // Setting language and locale
00175: $TT->push('Setting language and locale', '');
1 require("/srv/www/sources/typo3_src-6.2.12/typo3/sysext/cms/tslib/index_ts.php")
/srv/www/sources/typo3_src-6.2.12/index.php:
00026: ->redirectToInstallerIfEssentialConfigurationDoesNotExist();
00027:
00028: require(PATH_tslib . 'index_ts.php');