Home > TYPO3 > A look into the future – Typo3 4.3 and extbase

A look into the future – Typo3 4.3 and extbase

July 19th, 2009

logo-typo3Two new system plug-in have been introduced in TYPO3 4.3 CMS: extbase and fluid. Today, I’ll provide a brief overview of the first one. Any programmer interested in software engineering must’ve heard about MVC. If not, I wholeheartedly recommend taking a gander at least at the Wikipedia article here:(http://pl.wikipedia.org/wiki/MVC). Typo3 developers concluded that the current architecture ceased to be flexible and sufficient enough. tt_news demonstrates this quite nicely: the entire code is contained within one monolithic file, queries are mixed with view rendering and support of user actions isn’t very transparent. Any attempts at modification, or extension of functionality, take hours of work and bring much frustration to the developers.

Looking ahead

What’s a developer to do? Should we change the architecture and borrow from the tried-and-tested solutions such as MVC or AOP – especially considering that the newest version of PHP (5.3) comes with a plethora of new features that support these? I think that almost everyone acquainted with Typo3 have already heard about the FLOW3 project (http://flow3.typo3.org/) – the new framework that will the foundation for Typo3 v5. Everything there looks exceptional in terms of flexibility and ease of application development (true, the boys have some small problems with performance, but I’m sure that they can sort it out with a little time :) ). Flow3 and Typo3 v. 5 are technologies of the future, but we can have a glimpse of their advantages right now, thanks to the extbase plug-in. Plug-ins based on extbase will be easily modifiable to work with the newest version of Typo3.

How does it work?

Putting it simply, extbase has a main controller (the dispatcher) that handles “translation” between the old and new architectures. Up to now, launching a plug-in required calling its main class through TS:

//
  1. userFunc = tx_yourext_pi1->main

Now, when writing our plugin, we are calling the dispatcher.

//
  1. userFunc = tx_extbase_dispatcher->dispatch

If we forward an additional Typoscript with configuration, the dispatcher will register our controllers and handle their calls.
An example TS (from the blogexample plugin) can be found here:

//blogexample
  1. includeLibs.tx_extbase_dispatcher = EXT:extbase/class.tx_extbase_dispatcher.php
  2. tt_content.list.20.blogexample_blog = USER
  3. tt_content.list.20.blogexample_blog {
  4. userFunc = tx_extbase_dispatcher->dispatch
  5. pluginKey = blog
  6. extensionName = BlogExample
  7. controllers {
  8. 10.controllerName = Blog
  9. 10.actions = index,show,new,create,delete,edit,setup,test
  10. 20.controllerName = Post
  11. 20.actions = index,show
  12. 30.controllerName = Comment
  13. 30.actions = create
  14. }
  15. }

As you can see, we are registering three controllers and assign appropriate actions to each of them. The two diagrams below illustrate the sequences of a single request, and will greatly help you in understanding the entire process properly:

Flow3 diagram:

mvcframework_requestresponseworkflow

http://flow3.typo3.org/fileadmin/manual/MVCFramework_RequestResponseWorkflow.png

Diagram Typo3 v 4.3 (extbase)

http://www.typoplanet.de/mvc/mvc_sequence_v2.png

http://www.typoplanet.de/mvc/mvc_sequence_v2.png

As you can see, the dispatcher only acts a connecting point between the old and new architectures. Read more at: http://forge.typo3.org/wiki/typo3v4-mvc/MVC_Concept

For my new article I will present a plug-in that uses extbase, and describe it step by step.

  • Share/Save/Bookmark

maciek TYPO3 extbase, flow3, mvc

  1. No comments yet.
  1. No trackbacks yet.