SlideShare a Scribd company logo
1 of 30
Download to read offline
FLOW3,
Extbase &
Fluid
cook book   June 15th 2012, Québec
Bastian Waidelich
2002
2008
THEORY
DDD
D D D
omain   riven   esign
MODEL
MODEL
 MODEL
DRY
D R Y
on‘t   epeat   ourself
Duplication
is evil
KISS
K IS S
 eep   t   imple   tupid
1. Put your site in an Extension/Package

                            In Phoenix: „MyWebsiteCom“



                              Protect private folders
                              with .htaccess files:
                               deny from all
2. Use Fluid for your site template
page = PAGE
page {
  typeNum = 0

  10 = FLUIDTEMPLATE
  10.file = EXT:my_website_com/Resources/Private/Templates/Site.html
  10 {
}   file = EXT:my_website_com/Resources/Private/Templates/Site.html
    extbase.controllerExtensionName = MyWebsiteCom
  }
}
                                Specify extension name/package key
                                for localisation & resources

Phoenix:
page = TYPO3.TYPO3:Page
page.body.templatePath = 'resource://MyWebsiteCom/Private/Templates/Site.html'
DEMO
3. Layouts
Solution 1: different templates

page {
  …
  10 = FLUIDTEMPLATE
  10 {
    …
    file = CASE
    file {
       key.data = levelfield:-1,backend_layout_next_level,slide
       key.override.field = backend_layout

        default = TEXT
        default.value = EXT:my_website_com/…/Default.html

        2 = TEXT
        2.value = EXT:my_website_com/…/Wide.html
    }
}
3. Layouts
Solution 2: CSS

page {
…
  bodyTagCObject = CASE
  bodyTagCObject {
    key.data = levelfield:-1,backend_layout_next_level,slide
    key.override.field = backend_layout

        default = TEXT
        default.value = <body>

        2 = TEXT
        2.value = <body class="wide">
    }
}


Very clean, but not always possible
3. Layouts
Solution 3: Partials

10 {
  …
  variables {
     …
     layout = CASE
     layout {
       key.data = levelfield:-1,backend_layout_next_level,slide
       key.override.field = backend_layout

            default = TEXT
            default.value = Default

            2 = TEXT
            2.value = Wide
        }
    }
}


Site.html
<f:render partial="Content{layout}" />
DEMO
Extension
 Package
4. Continuously enhance model
Templates/Paper.html

<f:if condition="{paper.status} == 'accepted'">
   <p>{paper.title} is accepted</p>
</f:if>                                    This will will not work!




String comparison will be possible in Fluid!
But it‘s mostly not needed.
4. Continuously enhance model
Model/Paper.php

/**
 * @return boolean
 */
public function isAccepted() {
   return $this->status === self::STATUS_ACCEPTED;
}

Templates/Paper.html

<f:if condition="{paper.accepted} ">
   <p>{paper.title} is accepted</p>
</f:if>
DEMO
5. Encapsulate your hacks
Controller/BookController.php

public function tagCloudAction() {
  $books = $this->bookRepository->findAll();
  $tags = array();
  foreach ($books as $book) {
     foreach ($book->getTags() as $tag) {
        $tagCount = 1;
        if (isset($tags[$tag->getTitle()])) {
            $tagCount ++;
            $tags[$tag->getTitle()] = $tagCount;
     }
  }
  $this->view->assign(tags, $tags);
}
5. Encapsulate your hacks
Controller/BookController.php

public function tagCloudAction() {
  $tags = $this->tagCloudService->createTagCloud());
  $this->view->assign('tags', $tags);
}

TagCloudService interacts with Database directly

Book/TagCloud.html
<f:for each="{tags}" as="tag">
   <span class="tag popularity-{tag.popularity}">
      {tag.name}
   </span>
</f:for>
DEMO
6. Performance


CACHING!
Storage folder TSConfig:
TCEMAIN.clearCacheCmd = 1,2,3



AJAX!
DEMO
THANK YOU
@bwaidelich
github.com/bwaidelich

More Related Content

What's hot

Pourquoi WordPress n’est pas un CMS
Pourquoi WordPress n’est pas un CMSPourquoi WordPress n’est pas un CMS
Pourquoi WordPress n’est pas un CMS
Thomas Gasc
 
Creating WordPress Theme Faster, Smarter & Without Swearing
Creating WordPress Theme Faster, Smarter & Without SwearingCreating WordPress Theme Faster, Smarter & Without Swearing
Creating WordPress Theme Faster, Smarter & Without Swearing
martinwolak
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applications
elliando dias
 

What's hot (20)

Php mail program
Php mail programPhp mail program
Php mail program
 
06 Php Mysql Connect Query
06 Php Mysql Connect Query06 Php Mysql Connect Query
06 Php Mysql Connect Query
 
Pourquoi WordPress n’est pas un CMS
Pourquoi WordPress n’est pas un CMSPourquoi WordPress n’est pas un CMS
Pourquoi WordPress n’est pas un CMS
 
Creating WordPress Theme Faster, Smarter & Without Swearing
Creating WordPress Theme Faster, Smarter & Without SwearingCreating WordPress Theme Faster, Smarter & Without Swearing
Creating WordPress Theme Faster, Smarter & Without Swearing
 
07 Php Mysql Update Delete
07 Php Mysql Update Delete07 Php Mysql Update Delete
07 Php Mysql Update Delete
 
Session handling in php
Session handling in phpSession handling in php
Session handling in php
 
Drupal 8 simple page: Mi primer proyecto en Drupal 8.
Drupal 8 simple page: Mi primer proyecto en Drupal 8.Drupal 8 simple page: Mi primer proyecto en Drupal 8.
Drupal 8 simple page: Mi primer proyecto en Drupal 8.
 
SULTHAN's - PHP MySQL programs
SULTHAN's - PHP MySQL programsSULTHAN's - PHP MySQL programs
SULTHAN's - PHP MySQL programs
 
veracruz
veracruzveracruz
veracruz
 
Hpage
HpageHpage
Hpage
 
Empezando con Twig
Empezando con TwigEmpezando con Twig
Empezando con Twig
 
7 reasons why developers should love Joomla!
7 reasons why developers should love Joomla!7 reasons why developers should love Joomla!
7 reasons why developers should love Joomla!
 
Doing Things the WordPress Way
Doing Things the WordPress WayDoing Things the WordPress Way
Doing Things the WordPress Way
 
Freeingwebhost
FreeingwebhostFreeingwebhost
Freeingwebhost
 
Coding for php with mysql
Coding for php with mysqlCoding for php with mysql
Coding for php with mysql
 
Gem christmas calendar
Gem christmas calendarGem christmas calendar
Gem christmas calendar
 
kazumich@acmscamp2010spring
kazumich@acmscamp2010springkazumich@acmscamp2010spring
kazumich@acmscamp2010spring
 
Drupal Development (Part 2)
Drupal Development (Part 2)Drupal Development (Part 2)
Drupal Development (Part 2)
 
Fw1
Fw1Fw1
Fw1
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applications
 

Viewers also liked

FLOW3 Einführung auf dem TYPO3Camp Berlin 2012
FLOW3 Einführung auf dem TYPO3Camp Berlin 2012FLOW3 Einführung auf dem TYPO3Camp Berlin 2012
FLOW3 Einführung auf dem TYPO3Camp Berlin 2012
Christof Rodejohann
 
FLOW3: Security mit AOP
FLOW3: Security mit AOPFLOW3: Security mit AOP
FLOW3: Security mit AOP
netlogix
 
Weaving aspects in PHP with the help of Go! AOP library
Weaving aspects in PHP with the help of Go! AOP libraryWeaving aspects in PHP with the help of Go! AOP library
Weaving aspects in PHP with the help of Go! AOP library
Alexander Lisachenko
 

Viewers also liked (8)

Elemente Websolutions - FLOW3 Überblick
Elemente Websolutions - FLOW3 ÜberblickElemente Websolutions - FLOW3 Überblick
Elemente Websolutions - FLOW3 Überblick
 
FLOW3 Einführung auf dem TYPO3Camp Berlin 2012
FLOW3 Einführung auf dem TYPO3Camp Berlin 2012FLOW3 Einführung auf dem TYPO3Camp Berlin 2012
FLOW3 Einführung auf dem TYPO3Camp Berlin 2012
 
Get into the FLOW with Extbase
Get into the FLOW with ExtbaseGet into the FLOW with Extbase
Get into the FLOW with Extbase
 
Domain-driven design - eine Einführung
Domain-driven design - eine EinführungDomain-driven design - eine Einführung
Domain-driven design - eine Einführung
 
FLOW3: Security mit AOP
FLOW3: Security mit AOPFLOW3: Security mit AOP
FLOW3: Security mit AOP
 
Weaving aspects in PHP with the help of Go! AOP library
Weaving aspects in PHP with the help of Go! AOP libraryWeaving aspects in PHP with the help of Go! AOP library
Weaving aspects in PHP with the help of Go! AOP library
 
A Practical Guide to Domain Driven Design: Presentation Slides
A Practical Guide to Domain Driven Design: Presentation SlidesA Practical Guide to Domain Driven Design: Presentation Slides
A Practical Guide to Domain Driven Design: Presentation Slides
 
Brand New World
Brand New WorldBrand New World
Brand New World
 

Similar to FLOW3, Extbase & Fluid cook book

Prefixルーティングとthemeのススメ
PrefixルーティングとthemeのススメPrefixルーティングとthemeのススメ
Prefixルーティングとthemeのススメ
Shusuke Otomo
 
Web applications with Catalyst
Web applications with CatalystWeb applications with Catalyst
Web applications with Catalyst
svilen.ivanov
 
Organize directories for applications with front-end and back-end with yii - ...
Organize directories for applications with front-end and back-end with yii - ...Organize directories for applications with front-end and back-end with yii - ...
Organize directories for applications with front-end and back-end with yii - ...
Framgia Vietnam
 

Similar to FLOW3, Extbase & Fluid cook book (20)

Prefixルーティングとthemeのススメ
PrefixルーティングとthemeのススメPrefixルーティングとthemeのススメ
Prefixルーティングとthemeのススメ
 
8 things to know about theming in drupal 8
8 things to know about theming in drupal 88 things to know about theming in drupal 8
8 things to know about theming in drupal 8
 
Anatomy of a reusable module
Anatomy of a reusable moduleAnatomy of a reusable module
Anatomy of a reusable module
 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practices
 
Alfredo-PUMEX
Alfredo-PUMEXAlfredo-PUMEX
Alfredo-PUMEX
 
Alfredo-PUMEX
Alfredo-PUMEXAlfredo-PUMEX
Alfredo-PUMEX
 
Alfredo-PUMEX
Alfredo-PUMEXAlfredo-PUMEX
Alfredo-PUMEX
 
Alfredo-PUMEX
Alfredo-PUMEXAlfredo-PUMEX
Alfredo-PUMEX
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 
Drupal 8 Every Day: An Intro to Developing With Drupal 8
Drupal 8 Every Day: An Intro to Developing With Drupal 8Drupal 8 Every Day: An Intro to Developing With Drupal 8
Drupal 8 Every Day: An Intro to Developing With Drupal 8
 
Web applications with Catalyst
Web applications with CatalystWeb applications with Catalyst
Web applications with Catalyst
 
How to connect redis and mule esb using spring data redis module
How to connect redis and mule esb using spring data redis moduleHow to connect redis and mule esb using spring data redis module
How to connect redis and mule esb using spring data redis module
 
Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2
 
Implement rich snippets in your webshop
Implement rich snippets in your webshopImplement rich snippets in your webshop
Implement rich snippets in your webshop
 
Organize directories for applications with front-end and back-end with yii - ...
Organize directories for applications with front-end and back-end with yii - ...Organize directories for applications with front-end and back-end with yii - ...
Organize directories for applications with front-end and back-end with yii - ...
 
[Laptrinh.vn] lap trinh Spring Framework 3
[Laptrinh.vn] lap trinh Spring Framework 3[Laptrinh.vn] lap trinh Spring Framework 3
[Laptrinh.vn] lap trinh Spring Framework 3
 
D7 theming what's new - London
D7 theming what's new - LondonD7 theming what's new - London
D7 theming what's new - London
 
The Flexibility of Drupal 8 | DCNLights 2017
The Flexibility of Drupal 8 | DCNLights 2017The Flexibility of Drupal 8 | DCNLights 2017
The Flexibility of Drupal 8 | DCNLights 2017
 
Drupal 8 Render Cache
Drupal 8 Render CacheDrupal 8 Render Cache
Drupal 8 Render Cache
 
Laravel 8 export data as excel file with example
Laravel 8 export data as excel file with exampleLaravel 8 export data as excel file with example
Laravel 8 export data as excel file with example
 

Recently uploaded

Recently uploaded (20)

The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Top 10 Symfony Development Companies 2024
Top 10 Symfony Development Companies 2024Top 10 Symfony Development Companies 2024
Top 10 Symfony Development Companies 2024
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 

FLOW3, Extbase & Fluid cook book

  • 1. FLOW3, Extbase & Fluid cook book June 15th 2012, Québec
  • 3.
  • 6. DDD
  • 7. D D D omain riven esign
  • 9. DRY
  • 10. D R Y on‘t epeat ourself
  • 12. KISS
  • 13. K IS S eep t imple tupid
  • 14. 1. Put your site in an Extension/Package In Phoenix: „MyWebsiteCom“ Protect private folders with .htaccess files: deny from all
  • 15. 2. Use Fluid for your site template page = PAGE page { typeNum = 0 10 = FLUIDTEMPLATE 10.file = EXT:my_website_com/Resources/Private/Templates/Site.html 10 { } file = EXT:my_website_com/Resources/Private/Templates/Site.html extbase.controllerExtensionName = MyWebsiteCom } } Specify extension name/package key for localisation & resources Phoenix: page = TYPO3.TYPO3:Page page.body.templatePath = 'resource://MyWebsiteCom/Private/Templates/Site.html'
  • 16. DEMO
  • 17. 3. Layouts Solution 1: different templates page { … 10 = FLUIDTEMPLATE 10 { … file = CASE file { key.data = levelfield:-1,backend_layout_next_level,slide key.override.field = backend_layout default = TEXT default.value = EXT:my_website_com/…/Default.html 2 = TEXT 2.value = EXT:my_website_com/…/Wide.html } }
  • 18. 3. Layouts Solution 2: CSS page { … bodyTagCObject = CASE bodyTagCObject { key.data = levelfield:-1,backend_layout_next_level,slide key.override.field = backend_layout default = TEXT default.value = <body> 2 = TEXT 2.value = <body class="wide"> } } Very clean, but not always possible
  • 19. 3. Layouts Solution 3: Partials 10 { … variables { … layout = CASE layout { key.data = levelfield:-1,backend_layout_next_level,slide key.override.field = backend_layout default = TEXT default.value = Default 2 = TEXT 2.value = Wide } } } Site.html <f:render partial="Content{layout}" />
  • 20. DEMO
  • 22. 4. Continuously enhance model Templates/Paper.html <f:if condition="{paper.status} == 'accepted'"> <p>{paper.title} is accepted</p> </f:if> This will will not work! String comparison will be possible in Fluid! But it‘s mostly not needed.
  • 23. 4. Continuously enhance model Model/Paper.php /** * @return boolean */ public function isAccepted() { return $this->status === self::STATUS_ACCEPTED; } Templates/Paper.html <f:if condition="{paper.accepted} "> <p>{paper.title} is accepted</p> </f:if>
  • 24. DEMO
  • 25. 5. Encapsulate your hacks Controller/BookController.php public function tagCloudAction() { $books = $this->bookRepository->findAll(); $tags = array(); foreach ($books as $book) { foreach ($book->getTags() as $tag) { $tagCount = 1; if (isset($tags[$tag->getTitle()])) { $tagCount ++; $tags[$tag->getTitle()] = $tagCount; } } $this->view->assign(tags, $tags); }
  • 26. 5. Encapsulate your hacks Controller/BookController.php public function tagCloudAction() { $tags = $this->tagCloudService->createTagCloud()); $this->view->assign('tags', $tags); } TagCloudService interacts with Database directly Book/TagCloud.html <f:for each="{tags}" as="tag"> <span class="tag popularity-{tag.popularity}"> {tag.name} </span> </f:for>
  • 27. DEMO
  • 28. 6. Performance CACHING! Storage folder TSConfig: TCEMAIN.clearCacheCmd = 1,2,3 AJAX!
  • 29. DEMO