[TYPO3-mvc] How to use jQuery in BE Module?
Alexander Dick
typo3 at dick.at
Tue Feb 14 15:36:35 CET 2012
Sweet, I will use this one too :-)
Am 10.02.2012 10:52, schrieb Stig Nørgaard Færch:
>
> class Tx_MyExt_ViewHelpers_Be_AddJsFileRelativeToExtensionViewHelper
> extends Tx_Fluid_ViewHelpers_Be_AbstractBackendViewHelper {
>
> /**
> *
> * @param string $extensionKey
> * @param string $pathToJsFile
> * @return void
> */
> public function render($extensionKey = NULL, $pathToJsFile = NULL) {
> if (NULL === $pathToJsFile) {
> $pathToJsFile = $this->renderChildren();
> }
> if (NULL === $extensionKey) {
> $extensionKey =
> t3lib_div::camelCaseToLowerCaseUnderscored($this->controllerContext->getRequest()->getControllerExtensionName());
>
> }
> // Remove the preceding /
> $pathToJsFile = ltrim($pathToJsFile, '/');
> $relativePath = t3lib_extMgm::extRelPath($extensionKey, TRUE);
> $pageRenderer = $this->getDocInstance()->getPageRenderer();
> /* @var $pageRenderer t3lib_PageRenderer */
> $pageRenderer->addJsFile($relativePath . $pathToJsFile);
> }
> }
More information about the TYPO3-project-typo3v4mvc
mailing list