TYPO3 CMS  TYPO3_6-2
FailsafeView.php
Go to the documentation of this file.
1 <?php
3 
17 
24 
29 
33  protected $layoutRootPath;
34 
38  protected $partialRootPath;
39 
43  protected $objectManager = NULL;
44 
48  public function __construct() {
49  $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
50  }
51 
59  public function render($alert = FALSE) {
60  if ($alert) {
61  return $this->renderAlertStatus();
62  }
64  $realView = $this->objectManager->get('TYPO3\\CMS\\Install\\View\\StandaloneView');
65  $realView->assignMultiple($this->variables);
66  $realView->setTemplatePathAndFilename($this->templatePathAndFileName);
67  $realView->setLayoutRootPath($this->layoutRootPath);
68  $realView->setPartialRootPath($this->partialRootPath);
69 
70  return $realView->render();
71  }
72 
78  protected function renderAlertStatus() {
79  $templatePath = preg_replace('#\.html$#', '.phtml', $this->templatePathAndFileName);
80  ob_start();
81  include $templatePath;
82  $renderedTemplate = ob_get_contents();
83  ob_end_clean();
84 
85  return $renderedTemplate;
86  }
87 
92  $this->templatePathAndFileName = $templatePathAndFileName;
93  }
94 
99  $this->layoutRootPath = $layoutRootPath;
100  }
101 
106  $this->partialRootPath = $partialRootPath;
107  }
108 }
setTemplatePathAndFileName($templatePathAndFileName)