ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Inspiring people to
Advanced Fluid   share
Advanced Fluid
                2. October 2010


Sebastian Kurf¨¹rst <sebastian@typo3.org>
 Bastian Waidelich <bastian@typo3.org>
ttp://www.sxc.hu/photo/816749




        Basic Ingredients
Variables
    $this->view->assign(¡®blogTitle¡¯, $blog->getTitle());

    <h1>The name of the blog is: {blogTitle}</h1>




                                                           Inspiring people to
Advanced Fluid                                             share
Object Accessors
    $this->view->assign(¡®blog¡¯, $blog);

    <h1>The name of the blog is: {blog.title}</h1>
                         Author: {blog.author}

    Getters are called automatically                 can be nested




                                                        Inspiring people to
Advanced Fluid                                          share
ViewHelpers                                                             Namespace
         Output logic is encapsulated in View Helpers (Tags)                 Declaration
         {namespace f=F3FluidViewHelpers}
v5
         <f:link.action action=¡°someAction¡°>Administration</f:link.action>

                                                                              Invocation of
v4       {namespace f=Tx_Fluid_ViewHelpers}                                       a tag
         <f:link.action action=¡°someAction¡°>Administration</f:link.action>

         Namespace f is included automatically




                                                                 Inspiring people to
     Advanced Fluid                                             share
Arrays
    <f:link action=¡°show¡° arguments=¡°{blog: blog, name: ¡®Hello¡¯}¡°>show
    posting</f:link>

    JSON object syntax                             objects as
                                                arguments can be
                                                     used!




                                                          Inspiring people to
Advanced Fluid                                            share
Summary: Basic Ingredients
    Object accessors: {blog.title}

    ViewHelpers: <f:for each=¡°{blog.posts}¡° as=¡°post¡°>...</f:for>

    Arrays




                                                             Inspiring people to
Advanced Fluid                                              share
http://www.?ickr.com/photos/sackerman519/4248877127/




                                      Advanced Features
Forms - Edit Blog Post
                                          object bound
                                            to 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>
                                           property
                                            binding



                                                                   Inspiring people to
Advanced Fluid                                                     share
Forms - New Blog Post
                                               Used
                                           on Validation
                                               Error
  <f:form action="create" object="{newPost}" 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>




                                                                   Inspiring people to
Advanced Fluid                                                     share
Cod
                e
<f:form action="update" object="{post}" name="post">                          <f:form action="create" object="{newPost}" name="newPost">




                                                 Dup
           <label for="author">Author</label><br />                                      <label for="author">Author</label><br />
           <f:form.textbox property="author.name" /><br />                               <f:form.textbox property="author.name" /><br />

            <label for="title">Title</label><br />                                        <label for="title">Title</label><br />




                                                                          lica
            <f:form.textbox property="title" /><br />                                     <f:form.textbox property="title" /><br />

            <label for="content">Content</label><br />                                    <label for="content">Content</label><br />




                                                                                                    tion
            <f:form.textarea property="content" rows="5" cols="40" /><br />               <f:form.textarea property="content" rows="5" cols="40" /><br />
</f:form>                                                                     </f:form>




                                                                                                                               !
Removing the Duplication
  <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 />




                                                                    Inspiring people to
Advanced Fluid                                                      share
Use Partials to
              remove Duplication

              Ausstecher-bild




Partials
remove
duplication
XSS
Improving the Edit Form
  <h2>{post.title}</h2>




                                          ?
  <f:form action="update" object="{post}" name="post">
         <f:render partial="BlogPostForm" />
  </f:form>




                                                     Inspiring people to
Advanced Fluid                                       share
Improving the Edit Form
  <h2><script> stealSessionAndSendTo('evil@drupal.org')</script></h2>


  <f:form action="update" object="{post}" name="post">
         <f:render partial="BlogPostForm" />
  </f:form>




                                                     Inspiring people to
Advanced Fluid                                       share
Improving the Edit Form
  <h2>{post.title}</h2>


  <f:form action="update" object="{post}" name="post">
         <f:render partial="BlogPostForm" />
  </f:form>

      Automatically
        Escaped!
                                                     Inspiring people to
Advanced Fluid                                       share
Secure by
  Default
Improving the Edit Form
  <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>




                                                     Inspiring people to
Advanced Fluid                                       share
Improving the Edit Form
  <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>




                                                     Inspiring people to
Advanced Fluid                                       share
Tag Syntax vs Inline Syntax
    <link rel="stylesheet" href="<f:uri.?le path='myStyle.css' />" />

    <link rel="stylesheet" href="{f:uri.?le(path: 'myStyle.css')}" />




  Both have their
    use-cases!
                                                      Inspiring people to
Advanced Fluid                                        share
Don't fear
the Inline
  Syntax!
        Sushi-Bild




                     sxc.hu: 1097400_18260778.jpg
Inspiring people to
Advanced Fluid   share
Render Date as Image
  <h2>{post.title}</h2>
  {post.date -> f:format.date(format:"Y-m-d")
             -> f:cObject(typoscriptObjectPath: 'lib.dateAsImage')}

  TypoScript

  lib.dateAsImage = IMAGE
  lib.dateAsImage {
                                Use TypoScript
                                where it makes
      ?le = GIFBUILDER
      ?le {
         10 = TEXT


  }
      }
         10.current = 1
                                    sense.
                                                         Inspiring people to
Advanced Fluid                                           share
Summary: Advanced Features
    Forms

    XSS Protection

    Inline Syntax

    cObject ViewHelper




                         Inspiring people to
Advanced Fluid           share
ToDo: Developing
                                             ViewHelpers
                                             -> Bild vom Kochen /
                                             Backen?

                                             MESSERBLOCK /
                                             Messer an wand




                                                                    Developing
                                                                    ViewHelpers
http://freerangestock.com/details.php?gid=37&pid=11545
Fluid Core does not contain any output
    logic, and no control structures!
<f:...>

Every tag is a class!
v5        {namespace f=F3FluidViewHelpers}
               <f:for>...</f:for>


     F3FluidViewHelpersForViewHelper
v4    {namespace f=Tx_Fluid_ViewHelpers}
           <f:for>...</f:for>


 Tx_Fluid_ViewHelpers_ForViewHelper
v4      {namespace f=Tx_Fluid_ViewHelpers}
     <f:link.action>...</f:link.action>


Tx_Fluid_ViewHelpers_Link_ActionViewHelper
AbstractViewHelper




AbstractTagBasedViewHelper       AbstractConditionViewHelper



                  AbstractWidgetViewHelper



                                             Inspiring people to
 Advanced Fluid                              share
AbstractViewHelper
{namespace blog=Tx_BlogExample_ViewHelpers}
<blog:greeting name="Kasper" />

class Tx_BlogExample_ViewHelpers_GreetingViewHelper
   extends ...AbstractViewHelper {

      /**
       * @param string name
       */
      public function render($name) {
         return 'Hello ' . $name;
      }
}

                                               Inspiring people to
Advanced Fluid                                 share
Example: <f:image src=/skurfuerst/advanced-fluid/"myImage.png" width="200" />

    With AbstractViewHelper:
    public function render($src) {




                 XSS
       return '<img src="' . $src . '" />'; // TODO: Scaling
    }




Advanced Fluid
                                          !              Inspiring people to
                                                         share
TagBasedViewHelper
    Example: <f:image src=/skurfuerst/advanced-fluid/"myImage.png" width="200" />

    With TagBasedViewHelper:

    protected $tagName = 'img';

    public function render($src) {
      $this->tag->addAttribute('src', $src);
      return $this->tag->render();
    }




                                               Inspiring people to
Advanced Fluid                                 share
TagBasedViewHelper
Additional Goodies
    Default Arguments: class, id, style, ...

    additionalAttributes

     <f:form.textbox
         additionalAttributes="{dojoType: 'dijit.form.TextBox'}" />




                                                      Inspiring people to
Advanced Fluid                                        share
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>




                                                           Inspiring people to
Advanced Fluid                                             share
IfViewHelper
  class IfViewHelper extends ...AbstractConditionViewHelper {
        /**
         * @param boolean $condition View helper condition
         */
        public function render($condition) {
             if ($condition) {
                  return $this->renderThenChild();
             } else {
                  return $this->renderElseChild();
             }
        }
  }


                                                   Inspiring people to
Advanced Fluid                                     share
Widgets




                           Inspiring people to
Advanced Fluid             share
Advanced Fluid
Sortable g
                               rid

                                          nd ar
                                     Ca le
         a ti on
 ag in                                            AJAX
P                                            Autoco
                                                    mpleti
                                                          on
           Widgets encapsulate
          complex (view-related)
              functionality.
                                             Alph
                      ps                          abe
              le   Ma                                     tica
                                                                   l lis
      Go   og                                                             ting


                                                    Inspiring people to
Advanced Fluid                                      share
It's simple to use them!




                              Inspiring people to
Advanced Fluid                share
It's simple to write them!




                              Inspiring people to
Advanced Fluid                share
http://www.sxc.hu/photo/983682

                                 Creating ViewHelpers is easy!
The Future
http://center.gordonswine.com /stuff/contentmgr/?les/fce82a1b415a4b47138a8b5e58b74dc2/images/33_smoking_cosmos_on_the_bar.jpg
TA




                      Inspiring people to
Advanced Fluid        share
Autocompletion




                                  Inspiring people to
Advanced Fluid                    share
Autocompletion




                                  Inspiring people to
Advanced Fluid                    share
????
                    ??
                    ??
                     ?
                  ??
                   ?
                  ?


                         Inspiring people to
Advanced Fluid           share
inspiring people to share.

More Related Content

Similar to Advanced Fluid (20)

AnkaraJUG Kas?m 2012 - PrimeFaces
AnkaraJUG Kas?m 2012 - PrimeFacesAnkaraJUG Kas?m 2012 - PrimeFaces
AnkaraJUG Kas?m 2012 - PrimeFaces
Ankara JUG
?
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practices
markparolisi
?
Lecture1and2
Lecture1and2Lecture1and2
Lecture1and2
andalibalzaghawi
?
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Arun Gupta
?
EECI2009 - From Design to Dynamic - Rapid ExpressionEngine Development
EECI2009 - From Design to Dynamic - Rapid ExpressionEngine DevelopmentEECI2009 - From Design to Dynamic - Rapid ExpressionEngine Development
EECI2009 - From Design to Dynamic - Rapid ExpressionEngine Development
FortySeven Media
?
Schulung Fluid Templating
Schulung Fluid TemplatingSchulung Fluid Templating
Schulung Fluid Templating
Sebastian Kurf¨¹rst
?
Flask ¨C Python
Flask ¨C PythonFlask ¨C Python
Flask ¨C Python
Max Claus Nunes
?
TOSSUG HTML5 ×x•ø•þ И˻`Åc±í†Î
TOSSUG HTML5 ×x•ø•þ И˻`Åc±í†ÎTOSSUG HTML5 ×x•ø•þ И˻`Åc±í†Î
TOSSUG HTML5 ×x•ø•þ И˻`Åc±í†Î
‚¥¸ñ ¸ß
?
X tag with web components - joe ssekono
X tag with web components - joe ssekonoX tag with web components - joe ssekono
X tag with web components - joe ssekono
Joseph Ssekono
?
Deliverance talk at plone meetup
Deliverance talk at plone meetupDeliverance talk at plone meetup
Deliverance talk at plone meetup
Jazkarta, Inc.
?
An Introduction To HTML5
An Introduction To HTML5An Introduction To HTML5
An Introduction To HTML5
Robert Nyman
?
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Arun Gupta
?
Create a simple and elegant bootstrap registration page
Create a simple and elegant bootstrap registration pageCreate a simple and elegant bootstrap registration page
Create a simple and elegant bootstrap registration page
Sanjaya Prakash Pradhan
?
Stop reinventing the wheel: Build Responsive Websites Using Bootstrap
Stop reinventing the wheel: Build Responsive Websites Using BootstrapStop reinventing the wheel: Build Responsive Websites Using Bootstrap
Stop reinventing the wheel: Build Responsive Websites Using Bootstrap
freshlybakedpixels
?
HTML5, The Open Web, and what it means for you - Altran
HTML5, The Open Web, and what it means for you - AltranHTML5, The Open Web, and what it means for you - Altran
HTML5, The Open Web, and what it means for you - Altran
Robert Nyman
?
Intro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin Development
Brad Williams
?
Facebook Open Graph implementation in the Harvard Gazette
Facebook Open Graph implementation in the Harvard GazetteFacebook Open Graph implementation in the Harvard Gazette
Facebook Open Graph implementation in the Harvard Gazette
Harvard Web Working Group
?
FLOW3, Extbase & Fluid cook book
FLOW3, Extbase & Fluid cook bookFLOW3, Extbase & Fluid cook book
FLOW3, Extbase & Fluid cook book
Bastian Waidelich
?
Jsf
JsfJsf
Jsf
Anis Bouhachem Djer
?
Introduction to backbone presentation
Introduction to backbone presentationIntroduction to backbone presentation
Introduction to backbone presentation
Brian Hogg
?
AnkaraJUG Kas?m 2012 - PrimeFaces
AnkaraJUG Kas?m 2012 - PrimeFacesAnkaraJUG Kas?m 2012 - PrimeFaces
AnkaraJUG Kas?m 2012 - PrimeFaces
Ankara JUG
?
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practices
markparolisi
?
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Arun Gupta
?
EECI2009 - From Design to Dynamic - Rapid ExpressionEngine Development
EECI2009 - From Design to Dynamic - Rapid ExpressionEngine DevelopmentEECI2009 - From Design to Dynamic - Rapid ExpressionEngine Development
EECI2009 - From Design to Dynamic - Rapid ExpressionEngine Development
FortySeven Media
?
TOSSUG HTML5 ×x•ø•þ И˻`Åc±í†Î
TOSSUG HTML5 ×x•ø•þ И˻`Åc±í†ÎTOSSUG HTML5 ×x•ø•þ И˻`Åc±í†Î
TOSSUG HTML5 ×x•ø•þ И˻`Åc±í†Î
‚¥¸ñ ¸ß
?
X tag with web components - joe ssekono
X tag with web components - joe ssekonoX tag with web components - joe ssekono
X tag with web components - joe ssekono
Joseph Ssekono
?
Deliverance talk at plone meetup
Deliverance talk at plone meetupDeliverance talk at plone meetup
Deliverance talk at plone meetup
Jazkarta, Inc.
?
An Introduction To HTML5
An Introduction To HTML5An Introduction To HTML5
An Introduction To HTML5
Robert Nyman
?
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Arun Gupta
?
Create a simple and elegant bootstrap registration page
Create a simple and elegant bootstrap registration pageCreate a simple and elegant bootstrap registration page
Create a simple and elegant bootstrap registration page
Sanjaya Prakash Pradhan
?
Stop reinventing the wheel: Build Responsive Websites Using Bootstrap
Stop reinventing the wheel: Build Responsive Websites Using BootstrapStop reinventing the wheel: Build Responsive Websites Using Bootstrap
Stop reinventing the wheel: Build Responsive Websites Using Bootstrap
freshlybakedpixels
?
HTML5, The Open Web, and what it means for you - Altran
HTML5, The Open Web, and what it means for you - AltranHTML5, The Open Web, and what it means for you - Altran
HTML5, The Open Web, and what it means for you - Altran
Robert Nyman
?
Intro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin Development
Brad Williams
?
Facebook Open Graph implementation in the Harvard Gazette
Facebook Open Graph implementation in the Harvard GazetteFacebook Open Graph implementation in the Harvard Gazette
Facebook Open Graph implementation in the Harvard Gazette
Harvard Web Working Group
?
FLOW3, Extbase & Fluid cook book
FLOW3, Extbase & Fluid cook bookFLOW3, Extbase & Fluid cook book
FLOW3, Extbase & Fluid cook book
Bastian Waidelich
?
Introduction to backbone presentation
Introduction to backbone presentationIntroduction to backbone presentation
Introduction to backbone presentation
Brian Hogg
?

More from Sebastian Kurf¨¹rst (9)

The Current State of TYPO3 Phoenix -- T3CON11The Current State of TYPO3 Phoenix -- T3CON11
The Current State of TYPO3 Phoenix -- T3CON11
Sebastian Kurf¨¹rst
?
FLOW3 Goes Semantic
FLOW3 Goes SemanticFLOW3 Goes Semantic
FLOW3 Goes Semantic
Sebastian Kurf¨¹rst
?
Fluid for Designers
Fluid for DesignersFluid for Designers
Fluid for Designers
Sebastian Kurf¨¹rst
?
Workshop Extension-Entwicklung mit Extbase und FluidWorkshop Extension-Entwicklung mit Extbase und Fluid
Workshop Extension-Entwicklung mit Extbase und Fluid
Sebastian Kurf¨¹rst
?
Fluid - Templating for professionals - T3CON09
Fluid - Templating for professionals - T3CON09Fluid - Templating for professionals - T3CON09
Fluid - Templating for professionals - T3CON09
Sebastian Kurf¨¹rst
?
Fluid - The Zen of Templating
Fluid - The Zen of TemplatingFluid - The Zen of Templating
Fluid - The Zen of Templating
Sebastian Kurf¨¹rst
?
MVC for TYPO3 4.3 with extbase
MVC for TYPO3 4.3 with extbaseMVC for TYPO3 4.3 with extbase
MVC for TYPO3 4.3 with extbase
Sebastian Kurf¨¹rst
?
FLOW3 - der aktuelle Stand. TYPO3 Usergroup DresdenFLOW3 - der aktuelle Stand. TYPO3 Usergroup Dresden
FLOW3 - der aktuelle Stand. TYPO3 Usergroup Dresden
Sebastian Kurf¨¹rst
?
Continuous Integration at T3CON08
Continuous Integration at T3CON08Continuous Integration at T3CON08
Continuous Integration at T3CON08
Sebastian Kurf¨¹rst
?
The Current State of TYPO3 Phoenix -- T3CON11The Current State of TYPO3 Phoenix -- T3CON11
The Current State of TYPO3 Phoenix -- T3CON11
Sebastian Kurf¨¹rst
?
Workshop Extension-Entwicklung mit Extbase und FluidWorkshop Extension-Entwicklung mit Extbase und Fluid
Workshop Extension-Entwicklung mit Extbase und Fluid
Sebastian Kurf¨¹rst
?
Fluid - Templating for professionals - T3CON09
Fluid - Templating for professionals - T3CON09Fluid - Templating for professionals - T3CON09
Fluid - Templating for professionals - T3CON09
Sebastian Kurf¨¹rst
?
FLOW3 - der aktuelle Stand. TYPO3 Usergroup DresdenFLOW3 - der aktuelle Stand. TYPO3 Usergroup Dresden
FLOW3 - der aktuelle Stand. TYPO3 Usergroup Dresden
Sebastian Kurf¨¹rst
?
Ad

Advanced Fluid

  • 2. Advanced Fluid 2. October 2010 Sebastian Kurf¨¹rst <sebastian@typo3.org> Bastian Waidelich <bastian@typo3.org>
  • 3. ttp://www.sxc.hu/photo/816749 Basic Ingredients
  • 4. Variables $this->view->assign(¡®blogTitle¡¯, $blog->getTitle()); <h1>The name of the blog is: {blogTitle}</h1> Inspiring people to Advanced Fluid share
  • 5. Object Accessors $this->view->assign(¡®blog¡¯, $blog); <h1>The name of the blog is: {blog.title}</h1> Author: {blog.author} Getters are called automatically can be nested Inspiring people to Advanced Fluid share
  • 6. ViewHelpers Namespace Output logic is encapsulated in View Helpers (Tags) Declaration {namespace f=F3FluidViewHelpers} v5 <f:link.action action=¡°someAction¡°>Administration</f:link.action> Invocation of v4 {namespace f=Tx_Fluid_ViewHelpers} a tag <f:link.action action=¡°someAction¡°>Administration</f:link.action> Namespace f is included automatically Inspiring people to Advanced Fluid share
  • 7. Arrays <f:link action=¡°show¡° arguments=¡°{blog: blog, name: ¡®Hello¡¯}¡°>show posting</f:link> JSON object syntax objects as arguments can be used! Inspiring people to Advanced Fluid share
  • 8. Summary: Basic Ingredients Object accessors: {blog.title} ViewHelpers: <f:for each=¡°{blog.posts}¡° as=¡°post¡°>...</f:for> Arrays Inspiring people to Advanced Fluid share
  • 10. Forms - Edit Blog Post object bound to 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> property binding Inspiring people to Advanced Fluid share
  • 11. Forms - New Blog Post Used on Validation Error <f:form action="create" object="{newPost}" 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> Inspiring people to Advanced Fluid share
  • 12. Cod e <f:form action="update" object="{post}" name="post"> <f:form action="create" object="{newPost}" name="newPost"> Dup <label for="author">Author</label><br /> <label for="author">Author</label><br /> <f:form.textbox property="author.name" /><br /> <f:form.textbox property="author.name" /><br /> <label for="title">Title</label><br /> <label for="title">Title</label><br /> lica <f:form.textbox property="title" /><br /> <f:form.textbox property="title" /><br /> <label for="content">Content</label><br /> <label for="content">Content</label><br /> tion <f:form.textarea property="content" rows="5" cols="40" /><br /> <f:form.textarea property="content" rows="5" cols="40" /><br /> </f:form> </f:form> !
  • 13. Removing the Duplication <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 /> Inspiring people to Advanced Fluid share
  • 14. Use Partials to remove Duplication Ausstecher-bild Partials remove duplication
  • 15. XSS Improving the Edit Form <h2>{post.title}</h2> ? <f:form action="update" object="{post}" name="post"> <f:render partial="BlogPostForm" /> </f:form> Inspiring people to Advanced Fluid share
  • 16. Improving the Edit Form <h2><script> stealSessionAndSendTo('evil@drupal.org')</script></h2> <f:form action="update" object="{post}" name="post"> <f:render partial="BlogPostForm" /> </f:form> Inspiring people to Advanced Fluid share
  • 17. Improving the Edit Form <h2>{post.title}</h2> <f:form action="update" object="{post}" name="post"> <f:render partial="BlogPostForm" /> </f:form> Automatically Escaped! Inspiring people to Advanced Fluid share
  • 18. Secure by Default
  • 19. Improving the Edit Form <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> Inspiring people to Advanced Fluid share
  • 20. Improving the Edit Form <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> Inspiring people to Advanced Fluid share
  • 21. Tag Syntax vs Inline Syntax <link rel="stylesheet" href="<f:uri.?le path='myStyle.css' />" /> <link rel="stylesheet" href="{f:uri.?le(path: 'myStyle.css')}" /> Both have their use-cases! Inspiring people to Advanced Fluid share
  • 22. Don't fear the Inline Syntax! Sushi-Bild sxc.hu: 1097400_18260778.jpg
  • 24. Render Date as Image <h2>{post.title}</h2> {post.date -> f:format.date(format:"Y-m-d") -> f:cObject(typoscriptObjectPath: 'lib.dateAsImage')} TypoScript lib.dateAsImage = IMAGE lib.dateAsImage { Use TypoScript where it makes ?le = GIFBUILDER ?le { 10 = TEXT } } 10.current = 1 sense. Inspiring people to Advanced Fluid share
  • 25. Summary: Advanced Features Forms XSS Protection Inline Syntax cObject ViewHelper Inspiring people to Advanced Fluid share
  • 26. ToDo: Developing ViewHelpers -> Bild vom Kochen / Backen? MESSERBLOCK / Messer an wand Developing ViewHelpers http://freerangestock.com/details.php?gid=37&pid=11545
  • 27. Fluid Core does not contain any output logic, and no control structures!
  • 29. v5 {namespace f=F3FluidViewHelpers} <f:for>...</f:for> F3FluidViewHelpersForViewHelper
  • 30. v4 {namespace f=Tx_Fluid_ViewHelpers} <f:for>...</f:for> Tx_Fluid_ViewHelpers_ForViewHelper
  • 31. v4 {namespace f=Tx_Fluid_ViewHelpers} <f:link.action>...</f:link.action> Tx_Fluid_ViewHelpers_Link_ActionViewHelper
  • 32. AbstractViewHelper AbstractTagBasedViewHelper AbstractConditionViewHelper AbstractWidgetViewHelper Inspiring people to Advanced Fluid share
  • 33. AbstractViewHelper {namespace blog=Tx_BlogExample_ViewHelpers} <blog:greeting name="Kasper" /> class Tx_BlogExample_ViewHelpers_GreetingViewHelper extends ...AbstractViewHelper { /** * @param string name */ public function render($name) { return 'Hello ' . $name; } } Inspiring people to Advanced Fluid share
  • 34. Example: <f:image src=/skurfuerst/advanced-fluid/"myImage.png" width="200" /> With AbstractViewHelper: public function render($src) { XSS return '<img src="' . $src . '" />'; // TODO: Scaling } Advanced Fluid ! Inspiring people to share
  • 35. TagBasedViewHelper Example: <f:image src=/skurfuerst/advanced-fluid/"myImage.png" width="200" /> With TagBasedViewHelper: protected $tagName = 'img'; public function render($src) { $this->tag->addAttribute('src', $src); return $this->tag->render(); } Inspiring people to Advanced Fluid share
  • 36. TagBasedViewHelper Additional Goodies Default Arguments: class, id, style, ... additionalAttributes <f:form.textbox additionalAttributes="{dojoType: 'dijit.form.TextBox'}" /> Inspiring people to Advanced Fluid share
  • 37. 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> Inspiring people to Advanced Fluid share
  • 38. IfViewHelper class IfViewHelper extends ...AbstractConditionViewHelper { /** * @param boolean $condition View helper condition */ public function render($condition) { if ($condition) { return $this->renderThenChild(); } else { return $this->renderElseChild(); } } } Inspiring people to Advanced Fluid share
  • 39. Widgets Inspiring people to Advanced Fluid share
  • 41. Sortable g rid nd ar Ca le a ti on ag in AJAX P Autoco mpleti on Widgets encapsulate complex (view-related) functionality. Alph ps abe le Ma tica l lis Go og ting Inspiring people to Advanced Fluid share
  • 42. It's simple to use them! Inspiring people to Advanced Fluid share
  • 43. It's simple to write them! Inspiring people to Advanced Fluid share
  • 44. http://www.sxc.hu/photo/983682 Creating ViewHelpers is easy!
  • 46. TA Inspiring people to Advanced Fluid share
  • 47. Autocompletion Inspiring people to Advanced Fluid share
  • 48. Autocompletion Inspiring people to Advanced Fluid share
  • 49. ???? ?? ?? ? ?? ? ? Inspiring people to Advanced Fluid share