T3CON09 Frankfurt - 12 September 2009   Inspiring people to
Fluid - Templating made easy            share
Fluid - Templating made easy
                 12.09.2009



Sebastian Kurfürst <sebastian@typo3.org>
TYPO3
                                 addict




                               Inspiring people to
Fluid - Templating made easy   share
TYPO3 v4 and v5


                     v4        v5




                                    Inspiring people to
Fluid - Templating made easy        share
Fluid - Templating for professionals - T3CON09
Einordnung - v4, v5 -
                           Transition




                                                   Inspiring people to
Fluid - Templating made easy                       share
Why are good frameworks
       important?


                                 Inspiring people to
  Fluid - Templating made easy   share
We need only
        End-User
         features
                               No!
                                     Inspiring people to
Fluid - Templating made easy         share
We need
              End-User
              features

                               Inspiring people to
Fluid - Templating made easy   share
We need
             Developer
             features,
                too!
                               Inspiring people to
Fluid - Templating made easy   share
Developing should be fun!

                               Inspiring people to
Fluid - Templating made easy   share
Productivity will
                           increase




                                               Inspiring people to
Fluid - Templating made easy                   share
Inspiring people to
Fluid - Templating made easy   share
What is a Template Engine?
          Data
         Data                           Template
         Data




                      Template Engine


                        rendered data
                            Data
                           Data
                                         Inspiring people to
Fluid - Templating made easy             share
Inspiring people to
Fluid - Templating made easy   share
Why another template engine?




                               Inspiring people to
Fluid - Templating made easy   share
Inspiring people to
Fluid - Templating made easy   share
Goals of Fluid




                                   Inspiring people to
Fluid - Templating made easy       share
The Zen of
              Templating



simple   powerful
                    http://www.sxc.hu/photo/821903
The Zen of
                  Templating



intuitive   easily extensible
                         http://www.sxc.hu/photo/821903
simple, elegant
                                                    template engine




http://www.flickr.com/photos/josefstuefer/9699426/
Help the template writer
     in many ways
Easy and clean
                  extensibility



http://www.sxc.hu/photo/338064
Support for different
  output formats
Goals of Fluid
    Simple, elegant template engine
    support for the template writer in many ways
    simple and clean extensibility
    different output formats possible




                                        Inspiring people to
Fluid - Templating made easy            share
Core
                                 Concepts

http://www.sxc.hu/photo/816749
Core Concepts

Variables
$this->view->assign(‘blogTitle’,
$blog->getTitle());


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

                               Inspiring people to
Fluid - Templating made easy   share
Core Concepts

Object Accessors
$this->view->assign(‘blog’, $blog);
<h1>The name of the blog is:
         {blog.title}</h1>
Author: {blog.author}
                               $blog->getAuthor();


                                      Inspiring people to
Fluid - Templating made easy          share
Core Concepts

     ViewHelpers                    namespace
                                    declaration
     {namespace f=F3FluidViewHelpers}
v5


     <f:link.action action=“someAction“>
        Administration           ViewHelper
     </f:link>                   invocation



                                     Inspiring people to
     Fluid - Templating made easy    share
Core Concepts

     ViewHelpers                    namespace
                                    declaration
     {namespace f=Tx_Fluid_ViewHelpers}
v4


     <f:link.action action=“someAction“>
        Administration           ViewHelper
     </f:link>                   invocation



                                     Inspiring people to
     Fluid - Templating made easy    share
Fluid Core does not contain any output
    logic, and no control structures!
<f:...>

Every tag is a class!
v4



     {namespace f=Tx_Fluid_ViewHelpers}
             <f:for>...</f:for>
 Tx_Fluid_ViewHelpers_ForViewHelper
v5



      {namespace f=F3FluidViewHelpers}
              <f:for>...</f:for>
     F3FluidViewHelpersForViewHelper
v5



     {namespace f=F3FluidViewHelpers}
     <f:link.action>...</f:link.action>
F3FluidViewHelpersLinkActionViewHelper
Core Concepts

Arrays
<f:link.action action=“show“
  arguments=“{blog: blog, name:
‘Hello’}“>
  show posting
</f:link>


                               Inspiring people to
Fluid - Templating made easy   share
Core Concepts

Basic Ingredients
    Object accessors: {blog.title}
    ViewHelpers: <f:for each=“{blog.posts}“
    as=“post“>...</f:for>
    Arrays




                                         Inspiring people to
Fluid - Templating made easy             share
simple loop




     Fluid for
professionals
Forms


v4           v5
Fluid - Templating for professionals - T3CON09
Fluid for professionals

 Forms
/**
 * Displays a form for creating a new blog
 *
 * @param F3BlogDomainModelBlog $newBlog A fresh blog object taken as a basis for the rendering
 * @return string An HTML form for creating a new blog
 * @dontvalidate $newBlog
 */
public function newAction(F3BlogDomainModelBlog $newBlog = NULL) {
       $this->view->assign('newBlog', $newBlog);
}

/**
 * Creates a new blog
 *
 * @param F3BlogDomainModelBlog $newBlog A fresh Blog object which has not yet been added to the repository
 * @return void
 */
public function createAction(F3BlogDomainModelBlog $newBlog) {
       $this->blogRepository->add($newBlog);
       $this->pushFlashMessage('Your new blog was created.');
       $this->redirect('index');
}


                                                                                Inspiring people to
 Fluid - Templating made easy                                                  share
Fluid for professionals

     Forms
     <f:form method="post" action="create" object="{newBlog}" name="newBlog">
          <label for="identifier">Identifier<br />
          <f:form.textbox property="identifier" id="identifier" />
          <br />
          <label for="name">Title</label><br />
          <f:form.textbox property="title" id="title" />
          <br />
          <label for="description">Description</label><br />
          <f:form.textarea property="description" rows="2" cols="40"
id="description" />
          <br />
          <f:form.submit value="Create blog" />
     </f:form>
</f:section>

                                                        Inspiring people to
     Fluid - Templating made easy                       share
Fluid for professionals




Code Text




                               Inspiring people to
Fluid - Templating made easy   share
Fluid for professionals

 Forms
/**
 * Displays a form for creating a new blog
 *
 * @param F3BlogDomainModelBlog $newBlog A fresh blog object taken as a basis for the rendering
 * @return string An HTML form for creating a new blog
 * @dontvalidate $newBlog
 */
public function newAction(F3BlogDomainModelBlog $newBlog = NULL) {
       $this->view->assign('newBlog', $newBlog);
}

/**
 * Creates a new blog
 *
 * @param F3BlogDomainModelBlog $newBlog A fresh Blog object which has not yet been added to the repository
 * @return void
 */
public function createAction(F3BlogDomainModelBlog $newBlog) {
       $this->blogRepository->add($newBlog);
       $this->pushFlashMessage('Your new blog was created.');
       $this->redirect('index');
}


                                                                                Inspiring people to
 Fluid - Templating made easy                                                  share
Fluid for professionals

 Forms
/**
 * Displays a form for creating a new blog
 *
 * @param F3BlogDomainModelBlog $newBlog A fresh blog object taken as a basis for the rendering
 * @return string An HTML form for creating a new blog
 * @dontvalidate $newBlog
 */
public function newAction(F3BlogDomainModelBlog $newBlog = NULL) {
       $this->view->assign('newBlog', $newBlog);
}

/**
 * Creates a new blog
 *
 * @param F3BlogDomainModelBlog $newBlog A fresh Blog object which has not yet been added to the repository
 * @return void
 */
public function createAction(F3BlogDomainModelBlog $newBlog) {
       $this->blogRepository->add($newBlog);
       $this->pushFlashMessage('Your new blog was created.');
       $this->redirect('index');
}


                                                                                Inspiring people to
 Fluid - Templating made easy                                                  share
Fluid - Templating for professionals - T3CON09
Layouts




                                     Inspiring people to
Fluid - Templating made easy         share
Layouts


v4             v5
Fluid for professionals

Layouts
<f:layout name="master" />
<f:section name="main">
  <h1> My content</h1>
</f:section>




                               Inspiring people to
Fluid - Templating made easy   share
Fluid for professionals

Layouts
<html> ...
<body>
  <f:render section="main" />
</body>




                               Inspiring people to
Fluid - Templating made easy   share
Fluid - Templating for professionals - T3CON09
Custom ViewHelpers




                               Inspiring people to
Fluid - Templating made easy   share
Custom ViewHelpers

v4   Task: Gravatar ViewHelper
         should take an e-mail address and output the
         gravatar image, if any.
         Expected output:
         <img src=“http://www.gravatar.com/avatar/md5
         ($email).jpg“ />




                                             Inspiring people to
     Fluid - Templating made easy            share
Custom ViewHelpers

v4   Task: Gravatar ViewHelper
         Expected usage:

         {namespace blog=Tx_Blog_ViewHelpers}
         <blog:gravatar email=“sebastian@typo3.org“ />




                                            Inspiring people to
     Fluid - Templating made easy           share
Custom ViewHelpers

v4   1. Create a ViewHelper skeleton
     class Tx_Blog_ViewHelpers_GravatarViewHelper
       extends Tx_Fluid_Core_AbstractViewHelper {
        public function render() {
           return ‘Hello World‘;
        }
     }




                                           Inspiring people to
     Fluid - Templating made easy          share
Custom ViewHelpers

v4     Implement the ViewHelper!
                              The PHPDoc must
     /**                    exist (for validation)

      * @param string $email The email to render as gravatar
      */
     public function render($email) {
        return ‘http://www.gravatar.com/gravatar/‘ . md5($email);
     }
                                           All method parameters will be
                                               ViewHelper arguments
                                                   automatically




                                                               Inspiring people to
       Fluid - Templating made easy                            share
Fluid - Templating for professionals - T3CON09
Fluid internals

                        TemplateView        View Helpers (Tags)
v5           v4      TemplateView       View Helpers (Tags)


     v5 v4                         Fluid Core




                                                 Inspiring people to
 Fluid - Templating made easy                    share
http://www.sxc.hu/photo/1132907
Autocompletion
Fluid - Templating for professionals - T3CON09
Balance
Fluid - Templating for professionals - T3CON09
????
   ??
   ??
    ?
 ??
  ?
 ?
inspiring people to share.

More Related Content

PDF
Schulung Fluid Templating
DOCX
Proyecto educativo lectura y tic
PPTX
Presentacion croquis
PPT
Flyr PHP micro-framework
PPTX
Fortum in India
PPTX
Red Logica
PPT
Liceo Pedagógico Maria Reina de la Paz
Schulung Fluid Templating
Proyecto educativo lectura y tic
Presentacion croquis
Flyr PHP micro-framework
Fortum in India
Red Logica
Liceo Pedagógico Maria Reina de la Paz

Viewers also liked (15)

PPT
Avatar Minihompy Proposal
PDF
Lineamientos para el uso y aplicacion de los recursos educativos digitales
PDF
36th auction for old stocks ands bonds / Scripophily / Historische Wertpapier...
PPTX
Kotler pom 15e_inppt_09
PPTX
2013 july gac webinar for tom
PDF
PDF
Marketing de atracción 2.0 (Inbound Marketing) - Oscar del Santo y Daniel Álv...
PDF
Pelan Hebat Produk Hebat e-naco
PPTX
Modelos de investigación cualitativa y cuantitativa
PDF
Gymkana los derechos del niño
PDF
96084535 informe-final-serums
PPTX
Funciones mentales superiores 4 to trimestre psicologia
 
PDF
Bob Dylan on Creativity
PPT
A Brief History of God
PDF
Minna no-nihongo (práctica)
Avatar Minihompy Proposal
Lineamientos para el uso y aplicacion de los recursos educativos digitales
36th auction for old stocks ands bonds / Scripophily / Historische Wertpapier...
Kotler pom 15e_inppt_09
2013 july gac webinar for tom
Marketing de atracción 2.0 (Inbound Marketing) - Oscar del Santo y Daniel Álv...
Pelan Hebat Produk Hebat e-naco
Modelos de investigación cualitativa y cuantitativa
Gymkana los derechos del niño
96084535 informe-final-serums
Funciones mentales superiores 4 to trimestre psicologia
 
Bob Dylan on Creativity
A Brief History of God
Minna no-nihongo (práctica)
Ad

Similar to Fluid - Templating for professionals - T3CON09 (20)

PDF
Fluid - The Zen of Templating
PDF
Implementing a Symfony Based CMS in a Publishing Company
PDF
Front-End Frameworks: a quick overview
PDF
DevTeach Ottawa - Webmatrix, see what the matrix can do for you!!
PDF
FLOW3, Extbase & Fluid cook book
KEY
A Framework for TemplaVoila Tutorial: T3CON09-Dallas
PDF
T3CON11 - Extreme Fluid - Patrick Lobacher typovision
PDF
Advanced Fluid
PDF
Beginner & Intermediate Guide to HTML5/CSS3 In Drupal
PDF
Pluggable patterns
PDF
EECI 2010 - The Power of ExpressionEngine's Dynamic Templates
PPTX
Rapid and Responsive - UX to Prototype with Bootstrap
PPTX
Prairie Dev Con West - 2012-03-14 - Webmatrix, see what the matrix can do fo...
PDF
Fluent Development with FLOW3 1.0
PPT
Develop a Quick and Dirty Web interface to your database: for the DBA and oth...
PPT
Introduction to web design
PDF
Surviving a Plane Crash, a NU.nl case-study
PPT
Introduction to web design
ODP
Introduction to web design
Fluid - The Zen of Templating
Implementing a Symfony Based CMS in a Publishing Company
Front-End Frameworks: a quick overview
DevTeach Ottawa - Webmatrix, see what the matrix can do for you!!
FLOW3, Extbase & Fluid cook book
A Framework for TemplaVoila Tutorial: T3CON09-Dallas
T3CON11 - Extreme Fluid - Patrick Lobacher typovision
Advanced Fluid
Beginner & Intermediate Guide to HTML5/CSS3 In Drupal
Pluggable patterns
EECI 2010 - The Power of ExpressionEngine's Dynamic Templates
Rapid and Responsive - UX to Prototype with Bootstrap
Prairie Dev Con West - 2012-03-14 - Webmatrix, see what the matrix can do fo...
Fluent Development with FLOW3 1.0
Develop a Quick and Dirty Web interface to your database: for the DBA and oth...
Introduction to web design
Surviving a Plane Crash, a NU.nl case-study
Introduction to web design
Introduction to web design
Ad

More from Sebastian Kurfürst (7)

PDF
The Current State of TYPO3 Phoenix -- T3CON11
PDF
FLOW3 Goes Semantic
PDF
Fluid for Designers
PDF
Workshop Extension-Entwicklung mit Extbase und Fluid
PDF
MVC for TYPO3 4.3 with extbase
PDF
FLOW3 - der aktuelle Stand. TYPO3 Usergroup Dresden
PDF
Continuous Integration at T3CON08
The Current State of TYPO3 Phoenix -- T3CON11
FLOW3 Goes Semantic
Fluid for Designers
Workshop Extension-Entwicklung mit Extbase und Fluid
MVC for TYPO3 4.3 with extbase
FLOW3 - der aktuelle Stand. TYPO3 Usergroup Dresden
Continuous Integration at T3CON08

Recently uploaded (20)

PDF
STKI Israel Market Study 2025 version august
PPTX
Custom Battery Pack Design Considerations for Performance and Safety
PDF
Accessing-Finance-in-Jordan-MENA 2024 2025.pdf
PPTX
Build Your First AI Agent with UiPath.pptx
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
Credit Without Borders: AI and Financial Inclusion in Bangladesh
PPTX
TEXTILE technology diploma scope and career opportunities
PDF
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
4 layer Arch & Reference Arch of IoT.pdf
PPTX
Microsoft Excel 365/2024 Beginner's training
PDF
giants, standing on the shoulders of - by Daniel Stenberg
PDF
Enhancing plagiarism detection using data pre-processing and machine learning...
PDF
sbt 2.0: go big (Scala Days 2025 edition)
PDF
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
PDF
Transform-Quality-Engineering-with-AI-A-60-Day-Blueprint-for-Digital-Success.pdf
PPT
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
PDF
Flame analysis and combustion estimation using large language and vision assi...
PDF
NewMind AI Weekly Chronicles – August ’25 Week IV
PDF
The influence of sentiment analysis in enhancing early warning system model f...
STKI Israel Market Study 2025 version august
Custom Battery Pack Design Considerations for Performance and Safety
Accessing-Finance-in-Jordan-MENA 2024 2025.pdf
Build Your First AI Agent with UiPath.pptx
NewMind AI Weekly Chronicles – August ’25 Week III
Credit Without Borders: AI and Financial Inclusion in Bangladesh
TEXTILE technology diploma scope and career opportunities
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
A review of recent deep learning applications in wood surface defect identifi...
4 layer Arch & Reference Arch of IoT.pdf
Microsoft Excel 365/2024 Beginner's training
giants, standing on the shoulders of - by Daniel Stenberg
Enhancing plagiarism detection using data pre-processing and machine learning...
sbt 2.0: go big (Scala Days 2025 edition)
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
Transform-Quality-Engineering-with-AI-A-60-Day-Blueprint-for-Digital-Success.pdf
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
Flame analysis and combustion estimation using large language and vision assi...
NewMind AI Weekly Chronicles – August ’25 Week IV
The influence of sentiment analysis in enhancing early warning system model f...

Fluid - Templating for professionals - T3CON09

  • 1. T3CON09 Frankfurt - 12 September 2009 Inspiring people to Fluid - Templating made easy share
  • 2. Fluid - Templating made easy 12.09.2009 Sebastian Kurfürst <[email protected]>
  • 3. TYPO3 addict Inspiring people to Fluid - Templating made easy share
  • 4. TYPO3 v4 and v5 v4 v5 Inspiring people to Fluid - Templating made easy share
  • 6. Einordnung - v4, v5 - Transition Inspiring people to Fluid - Templating made easy share
  • 7. Why are good frameworks important? Inspiring people to Fluid - Templating made easy share
  • 8. We need only End-User features No! Inspiring people to Fluid - Templating made easy share
  • 9. We need End-User features Inspiring people to Fluid - Templating made easy share
  • 10. We need Developer features, too! Inspiring people to Fluid - Templating made easy share
  • 11. Developing should be fun! Inspiring people to Fluid - Templating made easy share
  • 12. Productivity will increase Inspiring people to Fluid - Templating made easy share
  • 13. Inspiring people to Fluid - Templating made easy share
  • 14. What is a Template Engine? Data Data Template Data Template Engine rendered data Data Data Inspiring people to Fluid - Templating made easy share
  • 15. Inspiring people to Fluid - Templating made easy share
  • 16. Why another template engine? Inspiring people to Fluid - Templating made easy share
  • 17. Inspiring people to Fluid - Templating made easy share
  • 18. Goals of Fluid Inspiring people to Fluid - Templating made easy share
  • 19. The Zen of Templating simple powerful http://www.sxc.hu/photo/821903
  • 20. The Zen of Templating intuitive easily extensible http://www.sxc.hu/photo/821903
  • 21. simple, elegant template engine http://www.flickr.com/photos/josefstuefer/9699426/
  • 22. Help the template writer in many ways
  • 23. Easy and clean extensibility http://www.sxc.hu/photo/338064
  • 24. Support for different output formats
  • 25. Goals of Fluid Simple, elegant template engine support for the template writer in many ways simple and clean extensibility different output formats possible Inspiring people to Fluid - Templating made easy share
  • 26. Core Concepts http://www.sxc.hu/photo/816749
  • 27. Core Concepts Variables $this->view->assign(‘blogTitle’, $blog->getTitle()); <h1>The name of the blog is: {blogTitle}</h1> Inspiring people to Fluid - Templating made easy share
  • 28. Core Concepts Object Accessors $this->view->assign(‘blog’, $blog); <h1>The name of the blog is: {blog.title}</h1> Author: {blog.author} $blog->getAuthor(); Inspiring people to Fluid - Templating made easy share
  • 29. Core Concepts ViewHelpers namespace declaration {namespace f=F3FluidViewHelpers} v5 <f:link.action action=“someAction“> Administration ViewHelper </f:link> invocation Inspiring people to Fluid - Templating made easy share
  • 30. Core Concepts ViewHelpers namespace declaration {namespace f=Tx_Fluid_ViewHelpers} v4 <f:link.action action=“someAction“> Administration ViewHelper </f:link> invocation Inspiring people to Fluid - Templating made easy share
  • 31. Fluid Core does not contain any output logic, and no control structures!
  • 33. v4 {namespace f=Tx_Fluid_ViewHelpers} <f:for>...</f:for> Tx_Fluid_ViewHelpers_ForViewHelper
  • 34. v5 {namespace f=F3FluidViewHelpers} <f:for>...</f:for> F3FluidViewHelpersForViewHelper
  • 35. v5 {namespace f=F3FluidViewHelpers} <f:link.action>...</f:link.action> F3FluidViewHelpersLinkActionViewHelper
  • 36. Core Concepts Arrays <f:link.action action=“show“ arguments=“{blog: blog, name: ‘Hello’}“> show posting </f:link> Inspiring people to Fluid - Templating made easy share
  • 37. Core Concepts Basic Ingredients Object accessors: {blog.title} ViewHelpers: <f:for each=“{blog.posts}“ as=“post“>...</f:for> Arrays Inspiring people to Fluid - Templating made easy share
  • 38. simple loop Fluid for professionals
  • 39. Forms v4 v5
  • 41. Fluid for professionals Forms /** * Displays a form for creating a new blog * * @param F3BlogDomainModelBlog $newBlog A fresh blog object taken as a basis for the rendering * @return string An HTML form for creating a new blog * @dontvalidate $newBlog */ public function newAction(F3BlogDomainModelBlog $newBlog = NULL) { $this->view->assign('newBlog', $newBlog); } /** * Creates a new blog * * @param F3BlogDomainModelBlog $newBlog A fresh Blog object which has not yet been added to the repository * @return void */ public function createAction(F3BlogDomainModelBlog $newBlog) { $this->blogRepository->add($newBlog); $this->pushFlashMessage('Your new blog was created.'); $this->redirect('index'); } Inspiring people to Fluid - Templating made easy share
  • 42. Fluid for professionals Forms <f:form method="post" action="create" object="{newBlog}" name="newBlog"> <label for="identifier">Identifier<br /> <f:form.textbox property="identifier" id="identifier" /> <br /> <label for="name">Title</label><br /> <f:form.textbox property="title" id="title" /> <br /> <label for="description">Description</label><br /> <f:form.textarea property="description" rows="2" cols="40" id="description" /> <br /> <f:form.submit value="Create blog" /> </f:form> </f:section> Inspiring people to Fluid - Templating made easy share
  • 43. Fluid for professionals Code Text Inspiring people to Fluid - Templating made easy share
  • 44. Fluid for professionals Forms /** * Displays a form for creating a new blog * * @param F3BlogDomainModelBlog $newBlog A fresh blog object taken as a basis for the rendering * @return string An HTML form for creating a new blog * @dontvalidate $newBlog */ public function newAction(F3BlogDomainModelBlog $newBlog = NULL) { $this->view->assign('newBlog', $newBlog); } /** * Creates a new blog * * @param F3BlogDomainModelBlog $newBlog A fresh Blog object which has not yet been added to the repository * @return void */ public function createAction(F3BlogDomainModelBlog $newBlog) { $this->blogRepository->add($newBlog); $this->pushFlashMessage('Your new blog was created.'); $this->redirect('index'); } Inspiring people to Fluid - Templating made easy share
  • 45. Fluid for professionals Forms /** * Displays a form for creating a new blog * * @param F3BlogDomainModelBlog $newBlog A fresh blog object taken as a basis for the rendering * @return string An HTML form for creating a new blog * @dontvalidate $newBlog */ public function newAction(F3BlogDomainModelBlog $newBlog = NULL) { $this->view->assign('newBlog', $newBlog); } /** * Creates a new blog * * @param F3BlogDomainModelBlog $newBlog A fresh Blog object which has not yet been added to the repository * @return void */ public function createAction(F3BlogDomainModelBlog $newBlog) { $this->blogRepository->add($newBlog); $this->pushFlashMessage('Your new blog was created.'); $this->redirect('index'); } Inspiring people to Fluid - Templating made easy share
  • 47. Layouts Inspiring people to Fluid - Templating made easy share
  • 49. Fluid for professionals Layouts <f:layout name="master" /> <f:section name="main"> <h1> My content</h1> </f:section> Inspiring people to Fluid - Templating made easy share
  • 50. Fluid for professionals Layouts <html> ... <body> <f:render section="main" /> </body> Inspiring people to Fluid - Templating made easy share
  • 52. Custom ViewHelpers Inspiring people to Fluid - Templating made easy share
  • 53. Custom ViewHelpers v4 Task: Gravatar ViewHelper should take an e-mail address and output the gravatar image, if any. Expected output: <img src=“http://www.gravatar.com/avatar/md5 ($email).jpg“ /> Inspiring people to Fluid - Templating made easy share
  • 54. Custom ViewHelpers v4 Task: Gravatar ViewHelper Expected usage: {namespace blog=Tx_Blog_ViewHelpers} <blog:gravatar email=“[email protected]“ /> Inspiring people to Fluid - Templating made easy share
  • 55. Custom ViewHelpers v4 1. Create a ViewHelper skeleton class Tx_Blog_ViewHelpers_GravatarViewHelper extends Tx_Fluid_Core_AbstractViewHelper { public function render() { return ‘Hello World‘; } } Inspiring people to Fluid - Templating made easy share
  • 56. Custom ViewHelpers v4 Implement the ViewHelper! The PHPDoc must /** exist (for validation) * @param string $email The email to render as gravatar */ public function render($email) { return ‘http://www.gravatar.com/gravatar/‘ . md5($email); } All method parameters will be ViewHelper arguments automatically Inspiring people to Fluid - Templating made easy share
  • 58. Fluid internals TemplateView View Helpers (Tags) v5 v4 TemplateView View Helpers (Tags) v5 v4 Fluid Core Inspiring people to Fluid - Templating made easy share
  • 64. ???? ?? ?? ? ?? ? ?