Upgrade to Pro — share decks privately, control downloads, hide ads and more …

FLOW3 Experience 2012: Fluid #F3X

FLOW3 Experience 2012: Fluid #F3X

my presentation on the FLOW3 experience about #Fluid

Sebastian Kurfürst

April 03, 2012
Tweet

More Decks by Sebastian Kurfürst

Other Decks in Technology

Transcript

  1. Inspiring people to share Fluid Object Accessors $this->view->assign(‘blog’, $blog); <h1>The

    name of the blog is: {blog.title}</h1> Author: {blog.author} Verschachtelung mgl.
  2. Inspiring people to share Fluid ViewHelpers Ausgabelogik ist in View

    Helpers (Tags) gekapselt {namespace f=TYPO3\Fluid\ViewHelpers} <f:link.action action=“someAction“>Administration</f:link.action> {namespace f=Tx_Fluid_ViewHelpers} <f:link.action action=“someAction“>Administration</f:link.action> Namespace f ist automatisch registriert Namespace- Deklaration Tag-Aufruf v4 v5
  3. Inspiring people to share Fluid Arrays <f:link action=“show“ arguments=“{blog: blog,

    name: ‘Hello’}“>show posting</f:link> JSON syntax objekt-Argumente
  4. Inspiring people to share Fluid Forms - Edit Blog Post

    <f:form action="update" object="{post}" name="post"> <label for="author">Author</label><br /> <f:form.textbox property="author.name" /><br /> <label for="title">Title</label><br /> <f:form.textbox property="title" /><br /> <label for="content">Content</label><br /> <f:form.textarea property="content" rows="5" cols="40" /><br /> </f:form> Property Binding Objekt an Form gebunden
  5. Inspiring people to share <f:form action="create" name="newPost"> <label for="author">Author</label><br />

    <f:form.textbox property="author.name" /><br /> <label for="title">Title</label><br /> <f:form.textbox property="title" /><br /> <label for="content">Content</label><br /> <f:form.textarea property="content" rows="5" cols="40" /><br /> </f:form> Fluid Forms - New Blog Post
  6. Inspiring people to share Fluid Property Mapping Fluid Form Property

    Mapping Controller Action newPost[title]=F3PX newPost[content]=... newPost[author][name]=Sebastian TYPO3\Blog\Domain\Model\Post Vali- dierung
  7. Inspiring people to share Fluid Property Mapping Fluid Form Property

    Mapping Controller Action Vali- dierung Validierungs- fehler
  8. <f:form action="create" name="newPost"> <label for="author">Author</label><br /> <f:form.textbox property="author.name" /><br />

    <label for="title">Title</label><br /> <f:form.textbox property="title" /><br /> <label for="content">Content</label><br /> <f:form.textarea property="content" rows="5" cols="40" /><br /> </f:form> <f:form action="update" object="{post}" name="post"> <label for="author">Author</label><br /> <f:form.textbox property="author.name" /><br /> <label for="title">Title</label><br /> <f:form.textbox property="title" /><br /> <label for="content">Content</label><br /> <f:form.textarea property="content" rows="5" cols="40" /><br /> </f:form> Code-Duplikation!
  9. Inspiring people to share <f:form action="create" object="{newPost}" name="newPost"> <f:render partial="BlogPostForm"

    /> </f:form> Resources/Private/Partials/BlogPostForm.html <label for="author">Author</label><br /> <f:form.textbox property="author" /><br /> <label for="title">Title</label><br /> <f:form.textbox property="title" /><br /> <label for="content">Content</label><br /> <f:form.textarea property="content" rows="5" cols="40" /><br /> Fluid Partials
  10. Inspiring people to share Fluid Edit-Formular verbessern <h2>{post.title}</h2> <f:form action="update"

    object="{post}" name="post"> <f:render partial="BlogPostForm" /> </f:form> XSS?
  11. Inspiring people to share Fluid Edit-Formular verbessern <h2><script> stealSessionAndSendTo('[email protected]')</script></h2> <f:form

    action="update" object="{post}" name="post"> <f:render partial="BlogPostForm" /> </f:form>
  12. Inspiring people to share Fluid Edit-Formular verbessern <h2>{post.title}</h2> <f:form action="update"

    object="{post}" name="post"> <f:render partial="BlogPostForm" /> </f:form> Automatisch Escaped!
  13. Inspiring people to share Fluid Edit-Formular verbessern <h2>{post.title}</h2> <f:format.date format="Y-m-d">{post.date}</f:format.date>

    <f:form action="update" object="{post}" name="post"> <f:render partial="BlogPostForm" /> </f:form>
  14. Inspiring people to share Fluid Edit-Formular verbessern <h2>{post.title}</h2> {post.date ->

    f:format.date(format:"Y-m-d")} <f:form action="update" object="{post}" name="post"> <f:render partial="BlogPostForm" /> </f:form>
  15. Inspiring people to share Fluid Tag Syntax vs Inline Syntax

    <link rel="stylesheet" href="<f:uri.file path='myStyle.css' />" /> <link rel="stylesheet" href="{f:uri.file(path: 'myStyle.css')}" /> Es gibt Anwendungsfälle für jede Syntax!
  16. ToDo: Developing ViewHelpers -> Bild vom Kochen / Backen? MESSERBLOCK

    / Messer an wand http://freerangestock.com/details.php?gid=37&pid=11545 ViewHelper entwickeln
  17. Inspiring people to share Fluid AbstractViewHelper {namespace blog=TYPO3\BlogExample\ViewHelpers} <blog:greeting name="Kasper"

    /> class TYPO3\BlogExample\ViewHelpers\GreetingViewHelper extends ...AbstractViewHelper { /** * @param string name */ public function render($name) { return 'Hello ' . $name; } }
  18. Inspiring people to share Fluid Beispiel: <f:image src="myImage.png" width="200" />

    Mit AbstractViewHelper: public function render($src) { return '<img src="' . $src . '" />'; // TODO: Scaling } XSS!
  19. Inspiring people to share Fluid TagBasedViewHelper Beispiel: <f:image src="myImage.png" width="200"

    /> Mit TagBasedViewHelper: protected $tagName = 'img'; public function render($src) { $this->tag->addAttribute('src', $src); return $this->tag->render(); }
  20. Inspiring people to share Fluid TagBasedViewHelper Default-Argumente: class, id, style,

    ... additionalAttributes <f:form.textbox additionalAttributes="{dojoType: 'dijit.form.TextBox'}" /> Zusatz-Funktionen
  21. Inspiring people to share Fluid IfViewHelper <f:if condition="{blog.posts}"> <f:then> ...

    display blog posts ... </f:then> <f:else> No Blog Posts Available </f:else> </f:if> <li class="{f:if(condition: iteration.isFirst, then: 'isFirstElement')}">Some Element</li>
  22. Inspiring people to share Fluid IfViewHelper class IfViewHelper extends ...AbstractConditionViewHelper

    { /** * @param boolean $condition View helper condition */ public function render($condition) { if ($condition) { return $this->renderThenChild(); } else { return $this->renderElseChild(); } } }
  23. Inspiring people to share Fluid Widgets kapseln komplexe (View-) Funktionalität.

    AJAX Autovervollständigung Paginierung Alphabetische Sortierung Google Maps Kalender Sortierbares Grid
  24. Inspiring people to share Fluid Widget View Helper class PaginateViewHelper

    extends ...AbstractWidgetViewHelper { /** * @FLOW3\Inject * @var \TYPO3\Fluid\...\Controller\PaginateController */ protected $controller; public function render(/* define arguments here */) { return $this->initiateSubRequest(); } }
  25. Inspiring people to share Fluid Widget Controller class PaginateController extends

    \TYPO3\Fluid\Core\Widget \AbstractWidgetController { public function indexAction() { // use $this->widgetConfiguration[...] here } ... } + Fluid Widget Template
  26. Inspiring people to share Fluid AJAX Widgets: Autocompletion <f:widget.autocomplete for="name"

    objects="{people}" searchProperty="firstName" /> 100000000 people Intelligent Paging
  27. Inspiring people to share keine String-Vergleiche oder Methoden-Aufrufe in Fluid

    Neues Syntax-Konstrukt: ${...} Methodenaufrufe: ${foo.bar('baz', "bar", 42, true)} Vergleiche: ${foo == 'hello'}, ${callMethod(foo == 'hello')} Array-Literal: ${[a, b, c]} Fluid Embedded Expression Language (Eel) wie JavaScript
  28. Inspiring people to share Fluid Model Controller View (Fluid) bisher

    Model Controller TypoScript Zukunft Fluid Fluid Plugin