[TYPO3-50-general] RFC: Improved Shorthand Syntax

Bastian Waidelich bastian at typo3.org
Wed Oct 21 11:48:21 CEST 2009

Robert Lemke wrote:

Hi Robert,

> Karsten and I just wondered if even "->" is okay for XML – or is it only 
> allowed enclosed in CDATA?

I just realized that too this morning.
But Sebastian & me just checked the XML spec and made some tests:

<?xml version="1.0"?>
<html xmlns="http://typo3.org/ns/html-base"
   <f:for as="{name.bla->f:test()}" each="bar">
     testing {name.bla -> f:test()}
     <f:alias map=""></f:alias>
     <f:image title="{post.title->f:format.crop(maxChars: 
30)}">{post.title->f:format.crop(maxChars: 30)}</f:image>

is valid (try @ http://www.xmlvalidation.com/)
and autocompletion still works!

> Someone (Bastian?) noted that the task is somewhat similar to that of 
> TS2 processors [...]
> I still like it for that purpose but feel like it doesn't fit 100% for 
> Fluid templates.

Me too, I was just brainstorming.. But I don't like the "<<" syntax in 

> a) <f:image title="{post.title->f:format.crop(maxChars: 30)`}" />
> [...]
> I currently don't like a) very much because it has too much the notion 
> of being a method of the object instead of a processor to the property.

I don't think that's a problem really.
First, we could suggest to use spaces between the separator like

<f:image title="{post.title -> f:format.crop(maxChars: 30)}" />

But even if it looks like a method call - I don't think, that's a big 
thing. In the end it actually calls a method.

And the argument, Fluid should be usable for non PHP developers does not 
count for me either because:
If you think about who is going to write (complex) templates, it will be 
mostly people with at least some PHP knowledge. A templating engine, as 
powerful as fluid, that works for designers without HTML knowhow seems 
And for those, they'll have to learn a new syntax anyways - whether it's 
| or << or -> won't make a big difference IMO.


More information about the TYPO3-project-5_0-general mailing list