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 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:
-
userFunc = tx_yourext_pi1->main
Now, when writing our plugin, we are calling the dispatcher.
-
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:
-
includeLibs.tx_extbase_dispatcher = EXT:extbase/class.tx_extbase_dispatcher.php
-
tt_content.list.20.blogexample_blog = USER
-
tt_content.list.20.blogexample_blog {
-
userFunc = tx_extbase_dispatcher->dispatch
-
pluginKey = blog
-
extensionName = BlogExample
-
controllers {
-
10.controllerName = Blog
-
10.actions = index,show,new,create,delete,edit,setup,test
-
20.controllerName = Post
-
20.actions = index,show
-
30.controllerName = Comment
-
30.actions = create
-
}
-
}
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:
Diagram Typo3 v 4.3 (extbase)
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.


Recent Comments