[TYPO3-mvc] using views from a controller in another controller - possible or not?
Dennis Ahrens
dennis.ahrens at googlemail.com
Wed Sep 22 17:21:11 CEST 2010
Hi Dustin,
i'd prefer to extend the controller that is loacted in the other
extension inside the one you'll like to use it's actions. If you are
writing a plugin you can configure which actions should be available by
using the configurePlugin method in your ext_localconf.php and the
controller logic is still located at the corresponding extension.
I've just copied the view files in the past (what's a really bad
solution IMO). Have taken a short overview about the related code, now.
Maybe it works to set the different paths like this:
class Tx_YourNewExtension_Controller_FooController extends
Tx_YourOldExtension_Controller_BarController {
/**
* Sets the paths for the ViewLayer to the Extension we extend here.
*/
protected function initializeView(Tx_Extbase_MVC_View_ViewInterface
$view) {
// resolve the pathes
$view->setTemplateRootPath($templatePath);
$view->setLayoutRootPath($layoutPath);
$view->setPartialRootPath($partialPath);
}
}
Maybe you like to give it a try and report your results and ideas :)
regards
Dennis
More information about the TYPO3-project-typo3v4mvc
mailing list