[TYPO3-core] RFC #16008: A new TypoScript cObject: FLUIDTEMPLATE

Bastian Waidelich bastian at typo3.org
Mon Oct 18 11:56:29 CEST 2010


Benjamin Mack wrote:

Hi,

> this is a SVN patch request.
> BT reference: http://bugs.typo3.org/view.php?id=16008

This is a great feature, thanks for your efforts!
Apart from the fact that I would also reckon to move the Fluid 
initialization into some kind of factory class (As Sebastian mentioned 
yesterday) I found some issues:

line 43:
 > protected function FLUIDTEMPLATE($conf) {

"FLUIDTEMPLATE" is quite a long word. on the other hand it makes the 
purpose pretty clear (especially to people who are used to "TEMPLATE")
Besides, in the v4 CGL it says "Type hinting must be used when function 
expects array or an instance of a certain class.". So the above should be
protected function FLUIDTEMPLATE(array $conf) {
right?


line 46ff:
 > if (!t3lib_extMgm::isLoaded('fluid')) {
 > 	return 'Please install "Fluid" in the Extension Manager!';
 > }

IMO the message should be more meaningful. E.g. 'You need to install 
"Fluid" in order to use the FLUIDTEMPLATE content element'.
(the same for the Extbase check in the following lines)


 > $layoutPath = $templatePath . '/layouts';

This variable should be named $layoutRootPath I'd say. And I'd vote to 
use UpperCamelCase folder names.
(The same in the following lines)


line 151ff:
 > $view->assign('data', $this->data);
 > $view->assign('current', $this->data[$this->currentValKey]);

It's possible to override "data" and "current" in the variables 
settings. This might lead to unexpected behaviors. I'd suggest to check 
the existence of $variables['data'] and $variables['current'] and throw 
an exception in case they're overridden..


line 158:
 > if (!is_array($cObjType)) {

What if $cObjType *is* an array? Shouldn't that be handled somehow?


A few other glitches I came across:

- Somehow the autoloader is not initialized correctly. Trying to use a 
custom viewhelper like this:

{namespace t=Tx_BlogExample_ViewHelpers}
<t:gravatar emailAddress="foo at bar.com" />

(with the blog_example installed)
I get the fatal error
"Class 'Tx_BlogExample_ViewHelpers_GravatarViewHelper' not found"

- Sections do not work as intended(?). At least both examples from the 
Steffens from 16.10. wouldn't work for me.

- This is another story, but it is not completely unrelated: Did you 
think about a good way to make Fluid somehow available to existing 
extensions?

Best,
Bastian


More information about the TYPO3-team-core mailing list