hallo typo3ler -
nachdem ich jetzt 2 tage damit verbracht habe fehler zu suchen
wende ich mich hilfesuchend an euch - da ich selbst ja nicht wirklich den plan habe und erst noch ganz am anfang von typo3 stehe....
ich habe das tutorial für den besucherzähler durchgearbeitet.
die folgende datei sollte mir ja eigentlich eine instanz von tslib_cObj erzeugen. dieses object ist aber leer!!!!!
das kann vielleicht daran liegen das die variablen $conf['pid'], $conf['pid.'], $conf['renderObj'], $conf['renderObj.'] leer sind?!?!
aber woran liegt das????
hier der code: (class.user_visitcounter_pi1.php)
<?php
/***************************************************************
* Copyright notice
*
* (c) 2004 Falko Gebhard (falko.gebhard@medicomp.de)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Plugin 'Visitor Counter' for the 'user_visitcounter' extension.
*
* @author Falko Gebhard <falko.gebhard@medicomp.de>
*/
require_once(PATH_tslib."class.tslib_pibase.php");
class user_visitcounter_pi1 extends tslib_pibase {
var $prefixId = "user_visitcounter_pi1"; // Same as class name
var $extKey = "user_visitcounter"; // The extension key.
/**
* [Put your description here]
*/
function main($content,$conf) {
$this->pi_USER_INT_obj=1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it's a USER_INT object!
$table = 'user_visitcounter';
//any page is configured
$pid = intval($this->cObj->stdWrap($conf['pid'], $conf['pid.']));
//if not use current page
$pid = $pid ? $pid : $GLOBALS['TSFE']->id;
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, 'pid=' . $pid, '', '', 1);
if($res)
{
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
}
else
{
$row = array();
$row['counter'] = 0;
}
$knownUser = $GLOBALS['TSFE']->fe_user->getKey('ses', $this->extKey);
if(!$knownUser)
{
$GLOBALS['TSFE']->fe_user->setKey('ses', $this->extKey, 1);
$GLOBALS['TSFE']->fe_user->storeSessionData();
$row['counter'] += 1;
}
if($row['uid'])
{
$this->cObj->DBgetUpdate($table, $row['uid'], $row, 'counter', true);
}
else
{
$this->cObj->DBgetInsert($table, $pid, $row, 'counter', true);
}
$lCObj = t3lib_div::makeInstance('tslib_cObj');
$lCObj->setParent($this->cObj->data, $this->cObj->currentRecord);
$lCObj->start($row, $table);
print $conf;
$content = $lCObj->cObjGetSingle($conf['renderObj'], $conf['renderObj.']);
if(!$content)
{
$content = "nurb";
}
return $this->pi_wrapInBaseClass($content);
}
}
//if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/user_visitcounter/pi1/class.user_visitcounter_pi1.php"]) {
// include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/user_visitcounter/pi1/class.user_visitcounter_pi1.php"]);
//}
?>
das setup:
# setup
plugin.user_visitcounter_pi1
{
pid.data = page:uid
renderObj = COA
renderObj
{
10 = TEXT
10.field = counter
10.noTrimWrap = || |
20 = TEXT
20.value = visitors on this page
}
}
und die datei ext_localconf.php:
(aus dieser datei sollten die zeilen entfernt werden die die datei 'ext_typoscript_editorcfg.txt' einbinden entfernt werden -> ich hoffe mal das ich die richtigen auskommentiert habe)
<?php
if (!defined ("TYPO3_MODE")) die ("Access denied.");
## Extending TypoScript from static template uid=43 to set up userdefined tag:
//t3lib_extMgm::addTypoScript($_EXTKEY,"editorcfg","tt_content.CSS_editor.ch.user_visitcounter_pi1 = < plugin.user_visitcounter_pi1.CSS_editor",43);
t3lib_extMgm::addPItoST43($_EXTKEY,"pi1/class.user_visitcounter_pi1.php","_pi1","list_type",0);
?>
das waren die dateien die bearbeitet werden sollten....
vielleicht weis irgend wer eine lösung.....
es ist halt so das es zu keiner ausgabe kommt(zumindest zu keiner ausgabe des objects!!! - wenn in $content aber nur text steht(bsp. "nurb") wird das schon ausgegeben!!)
mfg falko