Advertisement
Guest User

Untitled

a guest
Apr 25th, 2013
483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.44 KB | None | 0 0
  1. /**
  2.  * getFluidValue
  3.  *
  4.  * @param string $templateName template name (UpperCamelCase)
  5.  * @param array $variables variables to be passed to the Fluid view
  6.  * @param string $format format [optional] can be txt/html
  7.  * @return string
  8.  */
  9. protected function getFluidValue($templateName, array $variables = array(), $format = "html") {
  10.     $tmpView = $this->objectManager->create('Tx_Fluid_View_StandaloneView');
  11.     switch ($format) {
  12.         case "html" :
  13.             $tmpView->setFormat('html');
  14.             break;
  15.         case "txt" :
  16.             $tmpView->setFormat('txt');
  17.             break;
  18.         default:
  19.             $tmpView->setFormat('html');
  20.             break;
  21.     }
  22.     $extbaseFrameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
  23.     $templateRootPath = t3lib_div::getFileAbsFileName($extbaseFrameworkConfiguration['view']['templateRootPath']);
  24.     $partialRootPath = t3lib_div::getFileAbsFileName($extbaseFrameworkConfiguration['view']['partialRootPath']);
  25.     $templatePathAndFilename = $templateRootPath . $this->request->getControllerName().'/' . $templateName . ".$format";
  26.     $extensionName = $this->request->getControllerExtensionName();
  27.     $tmpView->getRequest()->setControllerExtensionName($extensionName);
  28.     $tmpView->setTemplatePathAndFilename($templatePathAndFilename);
  29.     $tmpView->setPartialRootPath($partialRootPath);
  30.     $tmpView->assignMultiple($variables);
  31.     $content = $tmpView->render();
  32.     return $content;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement