Bug #65340
closedShow error message when FLUIDTEMPLATE file path is incorrect
100%
Description
Wasted an hour on a problem which was a simple typo in my file path. Would be good if there were an error message if this happened. Example TS:
tt_content.cat_button = FLUIDTEMPLATE tt_content.cat_button { template = FILE template.file = EXT:so_product/Resources/Private/Templates/ContentELements/CategoryButton.html layoutRootPath = EXT:so_product/Resources/Private/Layouts/ }
Typo with `L` instead of `l` in `ContentELements`.
Suggestion for error message: `No such file or directory found`.
Updated by Markus Klein over 9 years ago
- Target version changed from 7.0 to 7.2 (Frontend)
What did you get? No error message at all?
Did you take a look at the messages displayed in Admin Panel?
Updated by Olle Haerstedt over 9 years ago
- Target version changed from 7.2 (Frontend) to 7.0
No error message at all. Confirmed in 6.2.9 and 7.2.
I think I've found the error.
This function is from FluidTemplateContentObject.php, where $templateSource will evaluate to empty string if not found.
/** * Set template * * @param array $conf With possibly set file resource * @return void * @throws \InvalidArgumentException */ protected function setTemplate(array $conf) { // Fetch the Fluid template if (!empty($conf['template']) && !empty($conf['template.'])) { $templateSource = $this->cObj->cObjGetSingle($conf['template'], $conf['template.']); // $templateSource is empty string, should be NULL? $this->view->setTemplateSource($templateSource); } else { $file = isset($conf['file.']) ? $this->cObj->stdWrap($conf['file'], $conf['file.']) : $conf['file']; /** @var $templateService \TYPO3\CMS\Core\TypoScript\TemplateService */ $templateService = $GLOBALS['TSFE']->tmpl; $templatePathAndFilename = $templateService->getFileName($file); $this->view->setTemplatePathAndFilename(PATH_site . $templatePathAndFilename); } }
But here in StandaloneView.php, $templateSource must be NULL to throw an error:
/** * Returns the Fluid template source code * * @param string $actionName Name of the action. This argument is not used in this view! * @return string Fluid template source * @throws InvalidTemplateResourceException */ protected function getTemplateSource($actionName = NULL) { if ($this->templateSource === NULL && $this->templatePathAndFilename === NULL) { throw new InvalidTemplateResourceException('No template has been specified. Use either setTemplateSource() or setTemplatePathAndFilename().', 1288085266); } if ($this->templateSource === NULL) { // Also check for empty string here? if (!is_file($this->templatePathAndFilename)) { throw new InvalidTemplateResourceException('Template could not be found at "' . $this->templatePathAndFilename . '".', 1288087061); } $this->templateSource = file_get_contents($this->templatePathAndFilename); } return $this->templateSource; }
Additionally, one could check for errors directly in setTemplate(), to fail as early as possible.
Updated by Olle Haerstedt over 9 years ago
- Target version changed from 7.0 to 7.2 (Frontend)
Updated by Gerrit Code Review over 9 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/37273
Updated by Gerrit Code Review over 9 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/37273
Updated by Benni Mack over 9 years ago
- Target version changed from 7.2 (Frontend) to 7.4 (Backend)
Updated by Gerrit Code Review over 9 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/37273
Updated by Susanne Moog over 9 years ago
- Target version changed from 7.4 (Backend) to 7.5
Updated by Benni Mack about 9 years ago
- Target version changed from 7.5 to 7 LTS
Updated by Gerrit Code Review about 9 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/37273
Updated by Gerrit Code Review about 7 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/37273
Updated by Gerrit Code Review about 7 years ago
Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/37273
Updated by Georg Ringer about 7 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 65cfbc4c7764140c5cc7db3f2b43fa40be53cfc6.
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed