[TYPO3] Problem reading html template for use with markerArray

Rens Admiraal typo3 at ambitiondesign.nl
Wed Jul 4 09:50:28 CEST 2007


Hi all,

I've a really strange problem. I try to use a html template in a  
plugin, but for some weird reason Typo does not get the contents of  
the file.

I've stripped my code a little to see where the problems starts, and  
that's with the $this->cObj->fileResource function.

I have the following code:

$file = t3lib_extMgm::extPath($this->extKey, 'pi1/template.html');  
		// a complete filename to make sure it's not something with the  
replacement of EXT:
$this->templateCode = $this->cObj->fileResource($file);
printf("File excists: %s<br/>Template code length: %s",
		is_file($file) ? 'true' : 'false',
		strlen($this->templateCode));


This should give something like:
File excists: true
Template code length: 746

But, the result is:
File excists: true
Template code length: 0


I've been searching for typos for a while, and read the extension  
development, using HTML-Templates tutorial over and over, but I just  
can't find what I'm doing wrong. Do I have to add anything more to  
this code?

class tx_bu74gmap_pi1 extends tslib_pibase {
	var $prefixId = 'tx_bu74gmap_pi1';		// Same as class name
	var $scriptRelPath = 'pi1/class.tx_bu74gmap_pi1.php';	// Path to  
this script relative to the extension dir.
	var $extKey = 'bu74gmap';	// The extension key.
	var $pi_checkCHash = TRUE;
	
	/**
	 * The main method of the PlugIn
	 *
	 * @param	string		$content: The PlugIn content
	 * @param	array		$conf: The PlugIn configuration
	 * @return	The content that is displayed on the website
	 */
	function main($content,$conf)	{
		$this->conf=$conf;
		$this->pi_setPiVarDefaults();
		$this->pi_loadLL();
		$GLOBALS['TSFE']->set_no_cache();
		
		$file = t3lib_extMgm::extPath($this->extKey, 'pi1/template.html');
		$this->templateCode = $this->cObj->fileResource($file);
		printf("File exists: %s<br/>Template code length: %s",
					is_file($file) ? 'true' : 'false',
					strlen($this->templateCode));

		return $this->pi_wrapInBaseClass($content);
	}
}


More information about the TYPO3-english mailing list