[Flow] Fluid: Fallback paths for templates

Bastian Waidelich bastian at typo3.org
Tue Jul 23 17:30:23 CEST 2013


Carsten Bleicker wrote:

Hi Carsten, thanks for your feedback!

> i like it to be sure, that any template is located at one place [...]
> dont you leave the "convention over configuration" idea in this case?
> especialy if you can switch the path just for a single template.
> do you agree?

Yes, kind of. But in reality there are too many scenarios to be covered 
*just* by conventions.

For example:
Imagine a package *My.News.Api* that adds a couple of templates to the 
*News* package only if the requested format is *json*.

In the best case this should just work even if you have a *My.Site* 
package that changed the template root path of the News package.


But I agree and personally I'll probably keep maintaining all templates 
in one place. But there has been great demand for that feature..


> if the "old" cms has influence on decissions to the fluid package it
> COULD be not a good one or a step backwards.

This is not really about a step backwards. Claus' solution would be 
perfectly doable in the Fluid package. I just don't think that we need 
the additional complexity.


> so if you have any good ideas, please dont stop top integrate them
> also if they produce problems on the cms side.

Unlike Flow & Extbase, the Fluid extension is created 
(semi)automatically from the package. With a core that drifts apart too 
much this won't be possible any longer.

This time it's more about a new feature that is/was about being added to 
the *extension* but that most probably won't make it into the package.


> do you think it could be a good idea to define a general central
> place for templates?
> maybe any templates could find a represantation by symlinking to
> the origins of the package, maybe by compile?

Interesting idea..
In Flow we have the convention of keeping templates in a package for 
easier deployment and shared development. IMO it wouldn't be a good idea 
to automatically copy/symlink templates into those packages.
But with Marcs change you could use your package as central template 
lookup by adding a Views.yaml file without request filter:


-
   options:
     templateRootPath: 'resource://This.Package/Private/Templates/@package'

With the suggested change you could also write:

-
   options:
     templateRootPaths: 
['resource://This.Package/Private/Templates/@package', 
'resource://@package/Private/Templates']

and it would first look in your *This.Package* and fallback to the default.
I think that's quite convenient and flexible.


>> I'm currently incorporating these changes to the Fluid package.
>> Including tests that should be done by next week so we can back
>> port those to the Fluid extension and adjust the documentation.

FYI: There has been some discussion going on in the MVC list [1]. I put 
this work on hold for now until this is resolved.


[1] http://forum.typo3.org/index.php/t/198140/

-- 
Bastian Waidelich
--
Core Developer Team

TYPO3 .... inspiring people to share!
Get involved: typo3.org


More information about the Flow mailing list