Recent posts

Advanced mail subscription

The CMS TYPO3 extension repository already offers a few plugins that can...
09 January 2012

Convenient In/Out animation using expressions

We recently had an opportunity to make a set of instructional animations...
16 December 2012

Nginx boost extension

Introduction  The Evo_nginx_boost plugin allows us to cache pages...
14 December 2011

Tags

A look into the future - Typo3 4.3 and extbase

Two 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 devel

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:

zaznacz
  1. userFunc = tx_yourext_pi1->main

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

zaznacz
  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:

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

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

 

Diagram Typo3 v 4.3 (extbase)

 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: 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.

No comments
Add comment

* - required field