Jobock schriebJetzt muss ich nur noch die Marker ###BACK### und ###NEXT### zum laufen bringen. Meine Einträge:
Diese Einträge habe ich in das "guest_template1.tmpl" eingefügt. So funktionierts bei mir 😉
Gruß
Steffen
Jobock schriebJetzt muss ich nur noch die Marker ###BACK### und ###NEXT### zum laufen bringen. Meine Einträge:
Diese Einträge habe ich in das "guest_template1.tmpl" eingefügt. So funktionierts bei mir 😉
Gruß
Steffen
Hat soweit geklappt. Nur bei dem "Next"-Marker wird die ID leider nicht eingesetzt. Komisch - beim "Back"-Marker geht's. Hat das schonmal wer erlebt?
Ich habe jetzt die ID meiner Gästebuchseite direkt im PHP-Code eingetragen.
Aber warum funzt das bei mir nicht so wie Mathias und Irene es geschrieben haben?
Hat wer 'ne Idee?
Hallo,
ich scheitere schon daran, die PHP-Datei hochzuladen. Es erscheint immer eine Meldung, die sagt, Dateien mit der Endung bzw. dem Typ php sind in fileadmin etc. nicht erlaubt.
Thorsten
deraxel schriebNur bei dem "Next"-Marker wird die ID leider nicht eingesetzt.
das würde mich auch interessieren warum im quell-code plöztlich ein $GLOBALS["id"] auftaucht?!
benutze ich die klasse von mathias, werden bei mir gar keine id's im link gesetzt (weder bei back, noch bei next).
werden die entsprehchenden stellen durch ein $config["pid_list"] ersetzt, funktioniert's, solange nicht mehrere pid's im setup definiert werden..
hat jemad einen eleganteren vorschlag?
ARRRGHHH..HILFE!
Ich hab die Originalklasse durch die von Mathias inkl. der Anpassungen von Iris ausgetauscht. Leiderr erhalte ich folgende Nachricht:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:htdocs ypo3 ypo3ext t_guestpiclass.tx_ttguest.php on line 258
Ich kann nicht wirklich erkennen, was das PRoblem ist?
Hat sonst niemand eine Fehlermeldung?
Außerdem verschwinden die aktuellen einteäge aus dem Gästebuch....?
Wie es eben so ist, gestern ging garnichts, heute auf anhieb alles. Manche dinge brauchen halt etwas länger:
Vielen Dan an Alle, ihr habt mich glücklich gemacht :p :p :p :p :p :p
Villeicht als Hilfe für diejenigen, die auch noch schwirigkeiten hatten:
Die Klasse von Mathias gemäß Iris anpassen (copy, delete, paste)
danach die Klasse umbenennen in *.inc statt *.php. Mit Typo3 in den Fileadmin-Ordner uploaden.
danach hab ich im Setup meines Templates diese Zeilen eingefügt:
includeLibs.ts_guest = fileadmin/templates/class.tx_ttguest.inc
plugin.tt_guest.showPerPage = 10
plugin.tt_guest.showPerPage.next = weiter
plugin.tt_guest.showPerPage.back = zurück
Nun noch das Guestbook-Template anpassen:
Die ###Back### und ###Next### Marker hab ich hinter diesen TAGs
<!-- ###POST_1### end-->
<!-- ###CONTENT### end -->
und vor diesem Tag
<!-- ###TEMPLATE_GUESTBOOK### end -->
platziert. Fertig es läuft prima.
Thats it...
ich brauch jetzt keine Tabletten mehr 😉
magengeschwür
Huch, nun kann man die Klasse nicht mehr runterladen. Hat die vielleicht noch jemand rumliegen und kann sie hier posten, damit auch alle was davon haben. Danke!
Gruß,
derHansen
habe glaube ich noch den Code von Mathias
hier der Code ohne ergänzung von Irene
basiert aber noch auf alter guestbook extension
<?php
/***************************************************************
* Copyright notice
*
* (c) 1999-2003 Kasper Skårhøj (kasper@typo3.com)
* 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.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* 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!
***************************************************************/
/**
* guestLib.inc
*
* Creates a guestbook/comment-list.
*
* TypoScript config:
* - See static_template "plugin.tt_guest"
* - See TS_ref.pdf
*
* Other resources:
* 'guest_submit.inc' is used for submission of the guest book entries to the database. This is done through the FEData TypoScript object. See the static_template 'plugin.tt_guest' for an example of how to set this up.
*
* @author Kasper Skårhøj <kasper@typo3.com>
*/
require_once(PATH_tslib."class.tslib_pibase.php");
class tx_ttguest extends tslib_pibase {
var $cObj; // The backReference to the mother cObj object set at call time
var $enableFields =""; // The enablefields of the tt_board table.
var $dontParseContent=0;
var $orig_templateCode="";
/**
* Main guestbook function.
*/
function main_guestbook($content,$conf) {
$content="";
// *************************************
// *** getting configuration values:
// *************************************
$alternativeLayouts = intval($conf["alternatingLayouts"])>0 ? intval($conf["alternatingLayouts"]) : 2;
// pid_list is the pid/list of pids from where to fetch the guest items.
$config["pid_list"] = trim($this->cObj->stdWrap($conf["pid_list"],$conf["pid_list."]));
$config["pid_list"] = $config["pid_list"] ? implode(t3lib_div::intExplode(",",$config["pid_list"]),",") : $GLOBALS["TSFE"]->id;
list($pid) = explode(",",$config["pid_list"]);
// "CODE" decides what is rendered:
$config["code"] = $this->cObj->stdWrap($conf["code"],$conf["code."]);
// template is read.
$this->orig_templateCode = $this->cObj->fileResource($conf["templateFile"]);
// globally substituted markers, fonts and colors.
$splitMark = md5(microtime());
$globalMarkerArray=array();
list($globalMarkerArray["###GW1B###"],$globalMarkerArray["###GW1E###"]) = explode($splitMark,$this->cObj->stdWrap($splitMark,$conf["wrap1."]));
list($globalMarkerArray["###GW2B###"],$globalMarkerArray["###GW2E###"]) = explode($splitMark,$this->cObj->stdWrap($splitMark,$conf["wrap2."]));
$globalMarkerArray["###GC1###"] = $this->cObj->stdWrap($conf["color1"],$conf["color1."]);
$globalMarkerArray["###GC2###"] = $this->cObj->stdWrap($conf["color2"],$conf["color2."]);
$globalMarkerArray["###GC3###"] = $this->cObj->stdWrap($conf["color3"],$conf["color3."]);
###### MATHIAS CODES
//debug($conf["showPerPage."]);
$start = t3lib_div::GPVar("start");
$start = (isset($start)) ? abs((int)$start) : 0;
$limit = $conf["showPerPage"]; // Datensätze pro Ausgabeseite
$this->init($this->cObj->enableFields("tt_guest")); // has to be done here already (Irene)
$resultID = mysql(TYPO3_db,"SELECT COUNT(uid) FROM tt_guest WHERE pid IN (".$pid.")".$this->enableFields);
$totalX = mysql_fetch_array($resultID);
$total = $totalX[0];
//echo $total;
$start = ($start >= $total) ? $total - $limit : $start;
if ($start > 0) {
$newStart = ($start - $limit < 0) ? 0 : ($start-$limit);
$globalMarkerArray["###BACK###"] = "<a href=".$PHP_SELF."?start=".$newStart."&id=".$GLOBALS["id"]."&no_cache=1>".$conf["showPerPage."]["back"]."</a>";
} else {
$globalMarkerArray["###BACK###"] = " ";
}
if ($start + $limit < $total) {
$newStart = $start + $limit;
$globalMarkerArray["###NEXT###"] = " <a href=".$PHP_SELF."?start=".$newStart."&id=".$GLOBALS["id"]."&no_cache=1>".$conf["showPerPage."]["next"]."</a>";
} else {
$globalMarkerArray["###NEXT###"] = " ";
}
// Substitute Global Marker Array
$this->orig_templateCode= $this->cObj->substituteMarkerArray($this->orig_templateCode, $globalMarkerArray);
// If the current record should be displayed.
$config["displayCurrentRecord"] = $conf["displayCurrentRecord"];
if ($config["displayCurrentRecord"]) {
$config["code"]="GUESTBOOK";
}
// *************************************
// *** doing the things...:
// *************************************
// $this->init($this->cObj->enableFields("tt_guest")); // already done some lines above
$this->dontParseContent = $conf["dontParseContent"];
$cObj =t3lib_div::makeInstance("tslib_cObj"); // Initiate new cObj, because we're loading the data-array
$codes=t3lib_div::trimExplode(",", $config["code"]?$config["code"]:$conf["defaultCode"],1);
if (!count($codes)) $codes=array("");
while(list(,$theCode)=each($codes)) {
$theCode = (string)strtoupper(trim($theCode));
switch($theCode) {
case "POSTFORM":
$lConf = $conf["postform."];
$content.=$cObj->FORM($lConf);
break;
case "GUESTBOOK":
$lConf=$conf;
if (!$lConf["subpartMarker"]) {
$lConf["subpartMarker"]="TEMPLATE_GUESTBOOK";
}
// Getting template subpart from file.
$templateCode = $cObj->getSubpart($this->orig_templateCode, "###".$lConf["subpartMarker"]."###");
if ($templateCode) {
// Getting the specific parts of the template
$postHeader=$this->getLayouts($templateCode,$alternativeLayouts,"POST");
// Fetching the guest book item(s) to display:
if ($config["displayCurrentRecord"]) {
$recentPosts=array();
$recentPosts[] = $this->cObj->data;
} else {
//$content.= $cObj->substituteSubpart($templateCode,"###CONTENT###",$subpartContent) ;
//$start = 0;
$recentPosts = $this->getItems($pid,$limit,$start);
}
// Traverse the items and display them:
reset($recentPosts);
$c_post=0;
$subpartContent="";
while(list(,$recentPost)=each($recentPosts)) {
// Passing data through stdWrap and into the markerArray
$cObj->start($recentPost); // Set this->data to the current record tt_guest record.
$markerArray=array();
$markerArray["###POST_TITLE###"] = $cObj->stdWrap($this->formatStr($recentPost["title"]), $conf["title_stdWrap."]);
$markerArray["###POST_CONTENT###"] = $cObj->stdWrap($this->formatStr($recentPost["note"]), $conf["note_stdWrap."]);
$markerArray["###POST_AUTHOR###"] = $cObj->stdWrap($this->formatStr($recentPost["cr_name"]), $conf["author_stdWrap."]);
$markerArray["###POST_EMAIL###"] = $cObj->stdWrap($this->formatStr($recentPost["cr_email"]), $conf["email_stdWrap."]);
$markerArray["###POST_WWW###"] = $cObj->stdWrap($this->formatStr($recentPost["www"]), $conf["www_stdWrap."]);
$markerArray["###POST_DATE###"] = $cObj->stdWrap($recentPost["crdate"],$conf["date_stdWrap."]);
$markerArray["###POST_TIME###"] = $cObj->stdWrap($recentPost["crdate"],$conf["time_stdWrap."]);
$markerArray["###POST_AGE###"] = $cObj->stdWrap($recentPost["crdate"],$conf["age_stdWrap."]);
// Substitute the markerArray in the proper template code (POST subparts, alternating)
$out=$postHeader[$c_post%count($postHeader)];
$c_post++;
$subpartContent.=$cObj->substituteMarkerArrayCached($out,$markerArray);
}
// Total Substitution:
if ($lConf["requireRecords"] && !count($recentPosts)) {
$content.= "";
} else {
$content.= $cObj->substituteSubpart($templateCode,"###CONTENT###",$subpartContent) ;
}
} else {
debug("No template code for the subpart maker ###".$lConf["subpartMarker"]."###");
}
break;
default:
$langKey = strtoupper($GLOBALS["TSFE"]->config["config"]["language"]);
$helpTemplate = $this->cObj->fileResource("EXT:tt_guest/pi/guest_help.tmpl");
// Get language version
$helpTemplate_lang="";
if ($langKey) {$helpTemplate_lang = $this->cObj->getSubpart($helpTemplate,"###TEMPLATE_".$langKey."###");}
$helpTemplate = $helpTemplate_lang ? $helpTemplate_lang : $this->cObj->getSubpart($helpTemplate,"###TEMPLATE_DEFAULT###");
// Markers and substitution:
$markerArray["###CODE###"] = $theCode;
$content.=$this->cObj->substituteMarkerArray($helpTemplate,$markerArray);
break;
}
}
return $content;
}
/**
* Main guestbook function.
*/
function init($enableFields) {
$this->enableFields = $enableFields;
}
/**
* Main guestbook function.
*/
function getLayouts($templateCode,$alternativeLayouts,$marker) {
$out=array();
for($a=0;$a<$alternativeLayouts;$a++) {
$m= "###".$marker.($a?"_".$a:"")."###";
if(strstr($templateCode,$m)) {
$out[]=$GLOBALS["TSFE"]->cObj->getSubpart($templateCode, $m);
} else {
break;
}
}
return $out;
}
/**
* Main guestbook function.
*/
function getItems($pid,$limit,$start) {
### BLÄTTERACTION
$query = "SELECT * FROM tt_guest WHERE pid IN (".$pid.")".$this->enableFields." ORDER BY crdate DESC LIMIT ".$start.",".$limit;
$res = mysql(TYPO3_db,$query);
//debug($query);
$out=array();
while($row = mysql_fetch_assoc($res)) {
$out[]=$row;
}
return $out;
}
/**
* Main guestbook function.
*/
function formatStr($str) {
if (!$this->dontParseContent) {
return nl2br(htmlspecialchars($str));
} else {
return $str;
}
}
}
if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/tt_guest/pi/class.tx_ttguest.php"]) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/tt_guest/pi/class.tx_ttguest.php"]);
}
?>
Danke!
die marker müssen ###BACK### ###NEXT###
und nicht ###Back### und ###Next### heissen.
bei mir gings sonst nicht.
Hallo T3ler,
Ich versuche diese Funktion ebenfalls hinzubekommen, leider immer noch mit Error:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /typo3_src-3.5.0/typo3/ext/tt_guest/pi/class.tx_ttguest.php on line 246
Habe die Anleitung gemäss T3 User Forum (DE) FAQ auf typo3.org gemacht:
**********************
Patch für tt_guest von der folgenden Location herunterladen (vielen Dank noch mal
(ich hoffe der Link bleibt erhalten, ansonsten mailt mir)
http://www.lefaux.com/fileadmin/lefaux/typo3/class.tx_ttguest.zip
entpacken und ins Verzeichnis ../ext/tt_guest/pi/ entpacken, vorhandene datei ersetzen
Im Template muss im Bereich zwischen ###TEMPLATE begin und dem
Bereich ###CONTENT begin
2 Marker ###BACK### und ###NEXT### eingefügt werden, das ist wenn das standarttemplate verwendet wird die datei ../ext/tt_guest/pi/guest_template1.tmpl
im setup müssen folgende Zeilen eingefügt werden
plugin.tt_guest.showPerPage = <anzahl der anzuzeigenden Einträge>
plugin.tt_guest.showPerPage.next = <Text der für die nächsten Einträge dastehen soll>
plugin.tt_guest.showPerPage.back = <Text der für die vorherigen Einträge dastehen soll>
********************
Auch alle anderen Varianten von oben gemacht.... Kein Erfolg.
Benutze noch Version 3.5 und die guestbook Version 1.05? Ob es wohl daran liegt?
Jede Hilfe ist sehr geschätzt!
Stefan
Hallo T3ler,
Mit der Funktion
if(!$res) die(mysql_error ());
konnte ich folgendes bewirken:
You have an error in your SQL syntax near '' at line 1
Dies erscheint als output. Ich erkenne aber immer noch nicht das Problem. Mag es sogar an der PHP version liegen oder tatsächlich beim SQL syntax?
Jegliche Hilfe ist sehr willkommen.
Grüsse
Stefan
Kleine Ergänzung für den, der Frames benutzt und bei dem die vorherigen Änderungen nicht zum Erfolg führten.
Ich musste, damit auch der Seitentyp (&type) übergeben wird, folgende zwei Zeilen ändern.
$globalMarkerArray["###BACK###"] = "<a href=".$PHP_SELF."?start=".$newStart."&id=".$GLOBALS["id"]."&no_cache=1>".$conf["showPerPage."]["back"]."</a>";
ersetzen durch
$globalMarkerArray["###BACK###"] = "<a href=".$PHP_SELF."?start=".$newStart.$typeStr."&id=".$GLOBALS["id"]."&no_cache=1>".$conf["showPerPage."]["back"]."</a>";
und
$globalMarkerArray["###NEXT###"] = " <a href=".$PHP_SELF."?start=".$newStart."&id=".$GLOBALS["id"]."&no_cache=1>".$conf["showPerPage."]["next"]."</a>";
ersetzen durch
$globalMarkerArray["###NEXT###"] = " <a href=".$PHP_SELF."?start=".$newStart.$typeStr."&id=".$GLOBALS["id"]."&no_cache=1>".$conf["showPerPage."]["next"]."</a>";
yip
Der Code incl. der Ergänzung von Irene.
Funktioniert bei mir unter Typo 3.5 mit und ohne Frames.
<?php
/***************************************************************
* Copyright notice
*
* (c) 1999-2003 Kasper Skårhøj (kasper@typo3.com)
* 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.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* 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!
***************************************************************/
/**
* guestLib.inc
*
* Creates a guestbook/comment-list.
*
* TypoScript config:
* - See static_template "plugin.tt_guest"
* - See TS_ref.pdf
*
* Other resources:
* 'guest_submit.inc' is used for submission of the guest book entries to the database. This is done through the FEData TypoScript object. See the static_template 'plugin.tt_guest' for an example of how to set this up.
*
* @author Kasper Skårhøj <kasper@typo3.com>
*/
require_once(PATH_tslib."class.tslib_pibase.php");
class tx_ttguest extends tslib_pibase {
var $cObj; // The backReference to the mother cObj object set at call time
var $enableFields =""; // The enablefields of the tt_board table.
var $dontParseContent=0;
var $orig_templateCode="";
/**
* Main guestbook function.
*/
function main_guestbook($content,$conf) {
$content="";
// *************************************
// *** getting configuration values:
// *************************************
$alternativeLayouts = intval($conf["alternatingLayouts"])>0 ? intval($conf["alternatingLayouts"]) : 2;
// pid_list is the pid/list of pids from where to fetch the guest items.
$config["pid_list"] = trim($this->cObj->stdWrap($conf["pid_list"],$conf["pid_list."]));
$config["pid_list"] = $config["pid_list"] ? implode(t3lib_div::intExplode(",",$config["pid_list"]),",") : $GLOBALS["TSFE"]->id;
list($pid) = explode(",",$config["pid_list"]);
// "CODE" decides what is rendered:
$config["code"] = $this->cObj->stdWrap($conf["code"],$conf["code."]);
// template is read.
$this->orig_templateCode = $this->cObj->fileResource($conf["templateFile"]);
// globally substituted markers, fonts and colors.
$splitMark = md5(microtime());
$globalMarkerArray=array();
list($globalMarkerArray["###GW1B###"],$globalMarkerArray["###GW1E###"]) = explode($splitMark,$this->cObj->stdWrap($splitMark,$conf["wrap1."]));
list($globalMarkerArray["###GW2B###"],$globalMarkerArray["###GW2E###"]) = explode($splitMark,$this->cObj->stdWrap($splitMark,$conf["wrap2."]));
$globalMarkerArray["###GC1###"] = $this->cObj->stdWrap($conf["color1"],$conf["color1."]);
$globalMarkerArray["###GC2###"] = $this->cObj->stdWrap($conf["color2"],$conf["color2."]);
$globalMarkerArray["###GC3###"] = $this->cObj->stdWrap($conf["color3"],$conf["color3."]);
// ###### MATHIAS CODES
// //debug($conf["showPerPage."]);
// $start = t3lib_div::GPVar("start");
// $start = (isset($start)) ? abs((int)$start) : 0;
// $limit = $conf["showPerPage"]; // Datensätze pro Ausgabeseite
//
// $this->init($this->cObj->enableFields("tt_guest")); // has to be done here already (Irene)
// $resultID = mysql(TYPO3_db,"SELECT COUNT(uid) FROM tt_guest WHERE pid IN (".$pid.")".$this->enableFields);
// $totalX = mysql_fetch_array($resultID);
// $total = $totalX[0];
//
// //echo $total;
//
// $start = ($start >= $total) ? $total - $limit : $start;
###### MATHIAS CODES
//debug($conf["showPerPage."]);
$start = t3lib_div::GPVar("start");
$start = (isset($start)) ? abs((int)$start) : 0;
$limit = $conf["showPerPage"]; // Datensätze pro Ausgabeseite
##### IRENE'S CODES
$this->init($this->cObj->enableFields("tt_guest")); // Variable enableFields belegen für die folgende sql-Abfrage
//echo $this->enableFields;
##### IRENE'S CODES ende
$resultID = mysql(TYPO3_db,"SELECT COUNT(uid) FROM tt_guest WHERE pid IN (".$pid.")".$this->enableFields);
$totalX = mysql_fetch_array($resultID);
$total = $totalX[0];
//echo $total;
$start = ($start >= $total) ? $total - $limit : $start;
##### IRENE'S CODES
$typeStr = $GLOBALS["type"] > 0 ? "&type=".$GLOBALS["type"] :""; // wird in die URL eingefügt, damits auch mit frames tut
##### IRENE'S CODES ende
if ($start > 0) {
$newStart = ($start - $limit < 0) ? 0 : ($start-$limit);
$globalMarkerArray["###BACK###"] = "<a href=".$PHP_SELF."?start=".$newStart.$typeStr."&id=".$GLOBALS["id"]."&no_cache=1>".$conf["showPerPage."]["back"]."</a>";
} else {
$globalMarkerArray["###BACK###"] = " ";
}
if ($start + $limit < $total) {
$newStart = $start + $limit;
$globalMarkerArray["###NEXT###"] = " <a href=".$PHP_SELF."?start=".$newStart.$typeStr."&id=".$GLOBALS["id"]."&no_cache=1>".$conf["showPerPage."]["next"]."</a>";
} else {
$globalMarkerArray["###NEXT###"] = " ";
}
// Substitute Global Marker Array
$this->orig_templateCode= $this->cObj->substituteMarkerArray($this->orig_templateCode, $globalMarkerArray);
// If the current record should be displayed.
$config["displayCurrentRecord"] = $conf["displayCurrentRecord"];
if ($config["displayCurrentRecord"]) {
$config["code"]="GUESTBOOK";
}
// *************************************
// *** doing the things...:
// *************************************
// $this->init($this->cObj->enableFields("tt_guest")); // already done some lines above
$this->dontParseContent = $conf["dontParseContent"];
$cObj =t3lib_div::makeInstance("tslib_cObj"); // Initiate new cObj, because we're loading the data-array
$codes=t3lib_div::trimExplode(",", $config["code"]?$config["code"]:$conf["defaultCode"],1);
if (!count($codes)) $codes=array("");
while(list(,$theCode)=each($codes)) {
$theCode = (string)strtoupper(trim($theCode));
switch($theCode) {
case "POSTFORM":
$lConf = $conf["postform."];
$content.=$cObj->FORM($lConf);
break;
case "GUESTBOOK":
$lConf=$conf;
if (!$lConf["subpartMarker"]) {
$lConf["subpartMarker"]="TEMPLATE_GUESTBOOK";
}
// Getting template subpart from file.
$templateCode = $cObj->getSubpart($this->orig_templateCode, "###".$lConf["subpartMarker"]."###");
if ($templateCode) {
// Getting the specific parts of the template
$postHeader=$this->getLayouts($templateCode,$alternativeLayouts,"POST");
// Fetching the guest book item(s) to display:
if ($config["displayCurrentRecord"]) {
$recentPosts=array();
$recentPosts[] = $this->cObj->data;
} else {
//$content.= $cObj->substituteSubpart($templateCode,"###CONTENT###",$subpartContent) ;
//$start = 0;
$recentPosts = $this->getItems($pid,$limit,$start);
}
// Traverse the items and display them:
reset($recentPosts);
$c_post=0;
$subpartContent="";
while(list(,$recentPost)=each($recentPosts)) {
// Passing data through stdWrap and into the markerArray
$cObj->start($recentPost); // Set this->data to the current record tt_guest record.
$markerArray=array();
$markerArray["###POST_TITLE###"] = $cObj->stdWrap($this->formatStr($recentPost["title"]), $conf["title_stdWrap."]);
$markerArray["###POST_CONTENT###"] = $cObj->stdWrap($this->formatStr($recentPost["note"]), $conf["note_stdWrap."]);
$markerArray["###POST_AUTHOR###"] = $cObj->stdWrap($this->formatStr($recentPost["cr_name"]), $conf["author_stdWrap."]);
$markerArray["###POST_EMAIL###"] = $cObj->stdWrap($this->formatStr($recentPost["cr_email"]), $conf["email_stdWrap."]);
$markerArray["###POST_WWW###"] = $cObj->stdWrap($this->formatStr($recentPost["www"]), $conf["www_stdWrap."]);
$markerArray["###POST_DATE###"] = $cObj->stdWrap($recentPost["crdate"],$conf["date_stdWrap."]);
$markerArray["###POST_TIME###"] = $cObj->stdWrap($recentPost["crdate"],$conf["time_stdWrap."]);
$markerArray["###POST_AGE###"] = $cObj->stdWrap($recentPost["crdate"],$conf["age_stdWrap."]);
// Substitute the markerArray in the proper template code (POST subparts, alternating)
$out=$postHeader[$c_post%count($postHeader)];
$c_post++;
$subpartContent.=$cObj->substituteMarkerArrayCached($out,$markerArray);
}
// Total Substitution:
if ($lConf["requireRecords"] && !count($recentPosts)) {
$content.= "";
} else {
$content.= $cObj->substituteSubpart($templateCode,"###CONTENT###",$subpartContent) ;
}
} else {
debug("No template code for the subpart maker ###".$lConf["subpartMarker"]."###");
}
break;
default:
$langKey = strtoupper($GLOBALS["TSFE"]->config["config"]["language"]);
$helpTemplate = $this->cObj->fileResource("EXT:tt_guest/pi/guest_help.tmpl");
// Get language version
$helpTemplate_lang="";
if ($langKey) {$helpTemplate_lang = $this->cObj->getSubpart($helpTemplate,"###TEMPLATE_".$langKey."###");}
$helpTemplate = $helpTemplate_lang ? $helpTemplate_lang : $this->cObj->getSubpart($helpTemplate,"###TEMPLATE_DEFAULT###");
// Markers and substitution:
$markerArray["###CODE###"] = $theCode;
$content.=$this->cObj->substituteMarkerArray($helpTemplate,$markerArray);
break;
}
}
return $content;
}
/**
* Main guestbook function.
*/
function init($enableFields) {
$this->enableFields = $enableFields;
}
/**
* Main guestbook function.
*/
function getLayouts($templateCode,$alternativeLayouts,$marker) {
$out=array();
for($a=0;$a<$alternativeLayouts;$a++) {
$m= "###".$marker.($a?"_".$a:"")."###";
if(strstr($templateCode,$m)) {
$out[]=$GLOBALS["TSFE"]->cObj->getSubpart($templateCode, $m);
} else {
break;
}
}
return $out;
}
/**
* Main guestbook function.
*/
function getItems($pid,$limit,$start) {
### BLÄTTERACTION
$query = "SELECT * FROM tt_guest WHERE pid IN (".$pid.")".$this->enableFields." ORDER BY crdate DESC LIMIT ".$start.",".$limit;
$res = mysql(TYPO3_db,$query);
//debug($query);
$out=array();
while($row = mysql_fetch_assoc($res)) {
$out[]=$row;
}
return $out;
}
/**
* Main guestbook function.
*/
function formatStr($str) {
if (!$this->dontParseContent) {
return nl2br(htmlspecialchars($str));
} else {
return $str;
}
}
}
if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/tt_guest/pi/class.tx_ttguest.php"]) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/tt_guest/pi/class.tx_ttguest.php"]);
}
?>
yip
Ich denke, ich habe vielleicht das selbe Problem wie Stefan72.
Bei mir kommt als Antwort von MySQL:
MySQL meldet:
#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF ( ! $res )die( mysql_error( ) )' at line 1
Mein Problem habe ich unter #154432 beschrieben.
Auch das Problem unter #4693 könnte gleich sein. Meine localconf.php scheint aber keine Fehler zu haben, da der dortige Tip mein Problem nicht gelöst hat.
Übrigens: Mir ist auch aufgefallen, daß bei mir das UserTracking nicht mehr richtig funktioniert.
Schon vorab Danke für jede Antwort.
Da vielleicht noch ein paar Probleme mit der Anpassung der class.tx_ttguest.php mit den Änderungen von Matthias und Irene haben, anbei ein Link zum Downloaden meines aktuellen angepassten Files
Dieses funktioniert bei mir auch mit tt_guest 1.0.8 und typo 3.6.2
Hier noch meine Constants
###
# Guestbook
###
# Change Text of Error Message
styles.content.mailform.badMess = Sie müssen folgende Felder ausfüllen:
# Notify when new guestbook entry
plugin.tt_guest.notifyEmail = Hier Benachrichtigungs Emailadresse eingeben
# Path to template
plugin.tt_guest.file.templateFile = Hier Pfad zum Template angeben
#
PAGE_TARGET = _top
und mein Setup Script
###
# Guestbook
###
# Path to new class.tx_ttguest.php
includeLibs.ts_guest = %hier Pfad zur angepassten class eingeben %/class.tx_ttguest.php
styles.content.mailform.target = _top
plugin.tt_guest {
# Text for Link next
showPerPage.next = weiter
# Text for Link back
showPerPage.back = zurück
# How many Entry´s per page ?
showPerPage = 3
# new guestbook entries have to be accepted from admin
# hidden = 1
postform.dataArray {
# Format of the input fields
# Fields which have to be filled out have to be sign with an * before data
10.type = *data[tt_guest][NEW][title]=input,60
20.type = *data[tt_guest][NEW][note]=textarea,60,6
30.type = *data[tt_guest][NEW][cr_name]=input,60
40.type = data[tt_guest][NEW][cr_email]=input,60
50.type = data[tt_guest][NEW][www]=input,60
# change Textmessages Input
10.label = Titel:
20.label = Kommentar:
30.label = Name:
40.label = Email:
50.label = Webseite:
60.type = formtype_db=submit
60.value = Eintrag senden
}
}
Viel Spass damit !
Renko
Hallo T3ler,
Mit der Version von Renko hat es schlussendlich geklappt mit Version 3.5! Besten Dank!
Tach auch 🙂
Ich könnte noch mal jemanden gebrauchen der mir zu dem Thema unter die Arme greift...
und zwar funzt bei mir der seitenumbruch nicht mehr. Vor kurzem hatte ich Ihn noch am laufen aber seitdem ich meine seiten in html ausgebe um alles etwas suchmaschinenfreundlicher zu machen, geht nichts mehr.
Ich bekomme nach wie vor nur 5 Einträge angezeigt und alles ist soweit ok. Nur wenn der sechste Eintrag kommt, wird mir zwar der "weiter" Link angezeigt aber er tuts nicht.
In der URL verweist er mich auf www.meinedomain.de/4.0.html?start
es fehlt die id un der ganze kram...
4.0.html steht dabei für mein Gästebuch
Kennt jemand ne Lösung für das Problem? Würde mich sehr freuen
Viele Grüße
Dennis
kennt keiner dieses Problem? 🙁
Auch ich habe seit dem Update auf 3.7 das Problem, daß bei mir - unabhängig von der Einstellung "plugin.tt_guest.showPerPage" - immer nur zwischen 2 und 3 Einträgen angezeigt werden.
:-(