[Typo3] Template section won't work
Joey Dwyer
joey at playnames.net
Mon Mar 28 00:03:29 CEST 2005
Hi list -
I am following the tutorial for Modern Template Building 2, and was having
trouble with switching to use the Template Auto Parser instead of the FILE
cObject. Each time I did it, the front-end page kept showing up blank. So, I
just continued to complete more changes as specified in the tutorial. I
changed the template record's Setup field with the following typoscript:
plugin.tx_automaketemplate_pi1.content < plugin.tx_nwstmpl_pi1
(my extension is named nwstmpl)
After I did this, I can no longer view any of the panes for the template
section in the back end. When I click on "Template" at the far left of the
back end, I can view "Template Tools" in the far right, but if I try to
click on any actual page, or to select a page from the "Template Tools", my
browser just tries to load it forever and eventually times out and can't
find the page. What did I mess up? It's possible that I typed something
wrong, but I can't even get back into the template to see what I did.
Just in case it's related to it, I have copied the text from tx_nwstmpl_pi1
below (minus copyright to save space):
<?php
// Code copied from tutorial Modern Template Building 2
require_once(PATH_tslib."class.tslib_pibase.php");
class tx_nwstmpl_pi1 extends tslib_pibase {
var $prefixId = "tx_tmplselect_pi1"; // Same as class name
var $scriptRelPath = "pi1/class.tx_nwstmpl_pi1.php"; // Path to this
script relative to the extension dir.
var $extKey = "nwstmpl"; // The extension key.
/**
* Reads the template-html file which is pointed to by the selector box
on the page
* and type parameter send through TypoScript.
* cObject (Content Object)
*
* @param string Empty content string passed. Not used.
* @param array TypoScript properties that belongs to this Content
Object.
* @return string The content of the required file.
*/
function main($content,$conf) {
// configuration of paths for template files:
$confArray = array(
"main" => "fileadmin/template/main/",
"sub" => "fileadmin/template/sub/"
);
// Getting the "type" from the input TypoScript configuration:
switch((string)$conf['templateType']) {
case 'sub':
$templateFile =
$GLOBALS['TSFE']->page['tx_nwstmpl_ca_tmpl'];
$relPath = $confArray['sub'];
break;
case 'main':
default:
$templateFile =
$GLOBALS['TSFE']->page['tx_nwstmpl_main_tmpl'];
$relPath = $confArray['main'];
break;
}
// Setting templateFile reference to the currently selected
value - or the default if not set:
$templateFile = $templateFile ? $templateFile :
$conf['defaultTemplateFileName'];
if ($relPath) { // If a value was found, we dare to continue:
// Get Absolute Filepath:
$absFilePath =
t3lib_div::getFileAbsFileName($relPath.$templateFile);
if ($absFilePath && @is_file($absFilePath)) {
$content = t3lib_div::getUrl($absFilePath);
return $content;
}
}
}
}
?>
Thanks in advance,
Joey
_________________________________________________
Joey Dwyer, Partner
PlayNames Publishing, LLC
www.playnames.net
817-886-6699
More information about the TYPO3-english
mailing list