My registered namespace stops to work after logout from BE

Viewed 179

I have my site package extension toolbox with a lot of custom ViewHelpers. For not violating DRY rule I registered my own namespace (with global namespace import tip) for recognizing it within Fluid instead placing at the beginning of each template as usually in typo3conf/ext/toolbox/ext_tables.php and in general that works:

$GLOBALS['TYPO3_CONF_VARS']['SYS']['fluid']['namespaces']['toolbox'] = ['BIESIOR\Toolbox\ViewHelpers'];

I can (or rather could) use my VH's like <toolbox:someViewHelper />, however after moving page from development to production (the same machine, just switched domains) suddenly I get an exception like:

TYPO3Fluid\Fluid\Core\Parser\UnknownNamespaceException

Fluid parse error in template Standard_action_Orangeheader_2c41396366318874342b894b22eff7acb311cc0c, line 2 at character 1. Error: Unknown Namespace: toolbox (error code 0). Template source chunk: {toolbox:containerEscape(condition: data.tx_mask_escape, start: 'true')}

What's frustrating this problem disappears when I'm logged to BE as an admin and preview the FE in the same browser, as fast I'll logout from BE and/or visit required FE page in another browser, the exception comes back.

As mentioned during development this problem didn't occur, after logout.

ViewHelper is used in page's template included in main TypoScript with FLUIDTEMPLATE cObject.

Had somebody such weird behaviour?

1 Answers

Use ext_localconf.php instead of ext_tables.php for it.

Not sure, but I think ext_table.php is Backend End (BE) context only, but you need the ViewHelper in the FE Context.

Related