Hallo,
ich muss eine bestehend Extension (FE-Plugin) anpassen. Das Problem besteht darin, dass sämtliche Seiten nicht gecacht werden. Wenn ich das Plugin als Seiteninhlat einfüge und die Kategorie bestimmt, so trage ich im Title eine gewissen Platzhalter {rezept:details} ein.
Wenn ich nun eine bestimmte Seite (im Frontend) daraus aufrufe finde ich im Backend > Admninwerkzeuge > Indexierung > List: Typo3 Pages immer nur den Platzhalter {rezept:details} und die eigentliche Seite wird nicht indexiert. Entsprechen wird das Rezept in der Suche nicht gefunden, sondern nur {rezept:details}.
Die Extension habe ich nicht selber geschrieben und bin ein Neuling was das Typo3/Erweiterungen angeht.
Zum Cachen bin ich auf diese Seite http://www.sk-typo3.de/Richtiges-Cachen-mit-pi_base.188.0.html gestoßen , doch bin ich damit nicht zum Erfolg gekommen.
require_once(PATH_tslib.'class.tslib_pibase.php');
class tx_moeto_pi2 extends tslib_pibase {
var $prefixId = 'tx_moeto_pi2';
var $scriptRelPath = 'pi2/class.tx_moeto_pi2.php';
var $extKey = 'erw_moeto';
var $pi_checkCHash = TRUE; // if this is a USER plugin // war vorher nicht vorhanden
protected $extUploadFolder = 'tx_moeto/';
protected $img_path = null;
protected $item_uid = null;
protected $item = null;
function main($content, $conf) {
$this->conf = $conf;
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
//auskommentiert
//$this->pi_USER_INT_obj = 1;
//quelle > http://www.sk-typo3.de/Richtiges-Cachen-mit-pi_base.188.0.html
// war vorher nicht vorhanden
$cache = 1;
$this->pi_USER_INT_obj = 0;
$this->setUp();
$this->fetchData();
$content = $this->buildOutput();
return $this->pi_wrapInBaseClass($content);
}
protected function setUp() {
$this->img_path = 'uploads/' . $this->extUploadFolder;
$this->item_uid = ctype_digit(t3lib_div::GPvar('product')) ? t3lib_div::GPvar('product') : null;
}
protected function fetchData() {
if ( is_null($this->item_uid) ) {
return;
}
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'p.uid, p.title, p.description, p.image, p.file, p.file_description, i.title as category_title', #fields
'tx_moeto_product p, tx_moeto_product_category_mm m, tx_moeto_category i', #table
'p.hidden = 0 and p.deleted = 0 and m.uid_local = p.uid and m.uid_foreign = i.uid and p.uid = ' . $this->item_uid, #where
'', #group
'p.sorting asc', #order
'1'#limit
);
while ( $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res) ) {
$this->item = $row;
}
}
protected function buildOutput() {
if ( is_null($this->item) ) {
$GLOBALS['TSFE']->content = str_replace('{rezept:details}', 'Details', $GLOBALS['TSFE']->content);
return 'Kein gültiges Produkt ausgewählt.';
}
$GLOBALS['TSFE']->content = str_replace('{rezept:details}', strip_tags($this->item['title']), $GLOBALS['TSFE']->content);
$conf = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_moeto.']['detail.'];
$path = $this->img_path . $this->item['image'];
$img_config = array();
$img_config['file'] = $path;
$img_config['file.']['maxW'] = $conf['imageMaxWidth'];
$img_config['file.']['maxH'] = $conf['imageMaxHeight'];
$thumbnail = array('html' => $this->cObj->IMAGE($img_config), 'path' => $this->cObj->IMG_RESOURCE($img_config));
$html = '';
$html .= '<h1>'.$this->item['category_title'].'</h1>';
$html .= '<h2>'.$this->item['title'].'</h2>';
$html .= $thumbnail['html'];
$html .= $this->pi_RTEcssText($this->item['description']);
return $html;
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/erw_moeto/pi2/class.tx_moeto_pi2.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/erw_moeto/pi2/class.tx_moeto_pi2.php']);
}