[TYPO3-english] Adding template to extension
Andre Cheung Tam He
cheungtamhe at frg.eur.nl
Thu Feb 3 16:55:38 CET 2011
Hi,
I'm relative new to Typo3 extension programming.
The alpha extension I made with kickstarter is working fine (getting
data and displaying it).
Now I want to add an template to make the extension more flexibele and
the problems start ;-)
I followed this wiki entry:
http://wiki.typo3.org/Extension_Development,_using_HTML-Templates
I created an ext_typoscript_setup.txt in the extension root folder
(typo3/typo3conf/ext/lucas_helpdesk) with this line:
plugin.lucas_helpdesk.templateFile =
EXT:lucas_helpdesk/template.html
Created an template.html in the extension root folder with these lines:
<h3>TEMPLATE</h3>
<p>This is a simple HTML template.</p>
<!-- ###TEMPLATE### begin -->
<h1>###MARKER1###</h1>
<h1>###MARKER2###</h1>
<!-- ###TEMPLATE### end -->
Added code as mentioned in the wiki to the
class.tx_lucashelpdesk_pi1.php file:
// Get the template
$this->templateHtml =
$this->cObj->fileResource($conf['templateFile']);
// Extract subparts from the template
$subpart = $this->cObj->getSubpart($this->templateHtml,
'###TEMPLATE###');
// Fill marker array
$markerArray['###MARKER1###'] = 'content for marker 1';
$markerArray['###MARKER2###'] = 'content for marker 2';
// Create the content by replacing the content markers in the
template
$content = $this->cObj->substituteMarkerArrayCached($subpart,
$markerArray);
return $this->pi_wrapInBaseClass($content);
I get an empty page because, my guess is, $conf['templateFile'] is empty.
Which step am I missing?(I cleared the frontend cache)
Kind regards,
André
More information about the TYPO3-english
mailing list