Ich habe eine simple fe Extension, die nur select Befehle, abhänig von 2 $_GET Parametern ausführt und den Seiteninhalt generiert. Allerdings braucht die komplette Seite über 2 Sekunden zum laden. Die Seite ist als nicht cachebar makiert, das würde ich gerne ändern.
Grundprinzip der Extension:
class xxx_pi1 extends tslib_pibase {
public $prefixId = 'tx_xxx_pi1'; // Same as class name
public $scriptRelPath = 'pi1/class.tx_xxx_pi1.php'; // Path to this script relative to the extension dir.
public $extKey = 'xxx'; // The extension key.
public $pi_checkCHash = TRUE;
public $template;
public $id;
/**
* The main method of the Plugin.
*
* @param string $content The Plugin content
* @param array $conf The Plugin configuration
* @return string The content that is displayed on the website
*/
public function main($content, array $conf) {
$this->conf = $conf;
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
// init
$this->id=$GLOBALS['TSFE']->id;
$content = $this->CreateCode();
return $this->pi_wrapInBaseClass($content);
}
public function CreateCode()
{
$this->parameter=$_GET['xx'];
$loginuid = $GLOBALS['TSFE']->fe_user->user['uid'];
$liste='';
$subpart=$this->cObj->getSubpart($this->template,'###1###');
$result=$GLOBALS['TYPO3_DB']->exec_SELECTquery(
'xxx', #select
'fe_users', #from
'username = "'.$this->parameter.'"
AND deleted = 0
, //.$this->id, #where
$groupBy='',
$orderBy='',
$limit='10');
while($row=$GLOBALS['TYPO3_DB']->sql_fetch_assoc($result))
{
$markerArray['###x###']='x';
$markerArray['###y###']='y';
$markerArray['###z###']='z';
$liste .= $this->cObj->substituteMarkerArrayCached($subpart,$markerArray);
$subpartArray['###ROW###']=$liste;
}
return $this->cObj->substituteMarkerArrayCached($subpart,$markerArray,$subpartArray,array());
}
Die Extension ist als Plugin im Contentbereich eingebaut. Das einfache aktivieren des Seitencache bewirkt ja nur, das nur die Seite, welche zuerst mit $_GET Parametern aufgerufen wird gecached wird. Alle anderen Varianten bekommen dann diese Seite ausgeliefert.