SlideShare una empresa de Scribd logo
1 de 30
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

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
 

La actualidad más candente (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
 

Destacado

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
 

Destacado (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 a 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 a 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
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

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