[TYPO3-dev] Using an HTML template with new extension

Sandy Matheson lists at mathesonuk.com
Mon Mar 27 19:13:22 CEST 2006


I am trying to set up a new extension with a simple external template.
I have watched Kasper's video tutorial and tried to implement the
structure in the wiki at:
http://wiki.typo3.org/index.php/Extension_Development,_using_HTML-Templates

However I get no content at all. The details of my pi1 file are below,
if anyone can give me an idea where I am going wrong it would be much
appreciated.

Sandy Matheseon

______________________

pi1 file content:

<?php

require_once(PATH_tslib.'class.tslib_pibase.php');

class tx_pdacny_pi1 extends tslib_pibase {
	var $prefixId = 'tx_pdacny_pi1';		// Same as
class name
	var $scriptRelPath = 'pi1/class.tx_pdacny_pi1.php';	//
Path to this script relative to the extension dir.
	var $extKey = 'pdacny';	// The extension key.
	var $pi_checkCHash = TRUE;
	
	/**
	 * [Put your description here]
	 */
	function main($content,$conf)	{
	$this->conf=$conf;
	$this->pi_setPiVarDefaults();
	$this->pi_loadLL();
	
	# Get the template
	$this->templateCode =
"http://www.mydomain.com/typo3conf/ext/my_extension/template.html";
 
 	# Get the parts out of the template
	$template["total"] =
$this->cObj->getSubpart($this->templateCode,"###MYTEMPLATE###");
  
	# create the content by replacing the marker in the template
	$markerArray["###MARKER1###"] = "This is come content for
Marker 1";
	$markerArray["###MARKER1###"] = "This is some content for
Marker 2";

	$content =
$this->cObj->substituteMarkerArrayCached($template["total"],$markerArray,
array(), array());
	return $content; 
	}
}

if (defined('TYPO3_MODE') &&
$TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/pdacny/pi1/class.tx_pdacny_pi1.php'])
{

include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/pdacny/pi1/class.tx_pdacny_pi1.php']);
}

?>




More information about the TYPO3-dev mailing list