[FLOW3-general] How to retrieve root path or (better) path to package in a controller

Robert Lemke robert at typo3.org
Thu Nov 3 16:48:32 CET 2011


Hi Jens,

Am 03.11.2011 um 15:42 schrieb Jens Hopp:

> I would like to render some yaml files in a controller.
> How can I retrieve the root path or (better) the path to the package the 
> controller resides in?

Nothing easier than that ;-)

/**
 * @FLOW3\Inject
 * @var \TYPO3\FLOW3\Package\PackageManagerInterface
 */
protected $packageManager;


public function fooAction() {
	$path = $this->packageManager->getPackage('Acme.Demo')->getPackagePath();
}


... there are also some more specialized functions like getClassesPath(), getResourcesPath() etc.

Cheers,
Robert



More information about the FLOW3-general mailing list