Hallo,
:o
ja also...
Wo muss das denn stehen? Kannst du helfen? Wäre riesig nett.
Hier der Code:
<?php
/***************************************************************
* Copyright notice
*
* (c) 2005 Andrea (a.herzog@kienastdv.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 'plugin.bivmetal' for the 'user_bivmetal' extension.
*
* @author Andrea <a.herzog@kienastdv.de>
*/
require_once(PATH_tslib.'class.tslib_pibase.php');
class user_bivmetal_pi1 extends tslib_pibase {
var $prefixId = 'user_bivmetal_pi1'; // Same as class name
var $scriptRelPath = 'pi1/class.user_bivmetal_pi1.php'; // Path to this script relative to the extension dir.
var $extKey = 'user_bivmetal'; // The extension key.
//var $pi_checkCHash = TRUE;
var $conf;
//var $emailMarkHTMLSuffix = '_HTML';
//var $charset = 'iso-8859-1'; // charset to be used in emails and form conversions
function main($content,$conf) {
$this->conf=$conf;
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
$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!
$content='
<strong>Sie suchen einen Metallbildner-Betrieb?</strong>
<p>Hier können Sie ein Unternehmen in Ihrer Nähe finden.<br />
Tragen Sie einfach die gewünschte Postleitzahl, oder auch nur die erste Zahl oder die
ersten beiden Zahlen ein und betätigen den Suche - Button. Schon erhalten Sie die gewünschte Information.</p>
<h3>Bitte geben Sie die Postleitzahl ein:</h3>
<form action="'.$this-">pi_getPageLink($GLOBALS['TSFE']->id).'" method="POST">
<input type="hidden" name="no_cache" value="1" />
<input type="text" name="'.$this-" />prefixId.'[plz]" value="'.htmlspecialchars($this->piVars['plz']).'">
<input type="submit" name="'.$this-" />prefixId.'[submit]" value="'.htmlspecialchars($this->pi_getLL('submit_button_label')).'">
</form>
<p>Klicken Sie hier '.$this->pi_linkToPage('um diese Seite noch einmal aufzurufen',$GLOBALS['TSFE']->id).'</p>
';
//Isset, weil PLZ auch mit 0 beginnen können. !empty kann nicht auf Null-Werte prüfen
if (isset($this->piVars['plz'])) {
$content .= $this->lookupPlz($content, $this->piVars['plz']);
return $this->pi_wrapInBaseClass($content);
} else {
return $this->pi_wrapInBaseClass($content);
}
}
function lookupPlz($content,$plz) {
//Die ausgelesenen Daten
$rows = $this->getItems($plz);
//Counts Adresses, see Line 82
$counter = sizeof($rows);
if (count($rows) == 0) {
$content = "<h3>Es wurden keine Einträge gefunden</h3>";
}
else {
$content = '<h3>Es wurde(n) ' . $counter . ' Adresse(n) gefunden:</h3>';
//ob der Punkt vor das Komma kommt, ist nicht sicher
$content2 .= '<table>';
foreach ($rows as $value) {
$content2 .='<tr><td colspan="2" bgcolor="#E7E9F0"><p><strong>'.$value['firma_1'].'</p></strong></td></tr>
<tr><td>'. $value['firma_2'].'</td></tr>
<tr><td>'. $value['strasse'].' '. $value['hausnr'].'</td></tr>
<tr><td>'. $value['plz']. ' '. $value['ort'].'</td></tr>
<tr><td>'. 'Tel.: '. $value['tel'].'</td></tr>
<tr><td>'. 'Fax: '. $value['fax'].'</td></tr>
<tr><td>'. $value['email'].'</td></tr>
<tr><td>'. $value['internet'].'</td></tr>
<tr><td>'. ' '.'</td></tr>';
}
$content2 .= '</table>';
$content = $content . $content2;
}
return $content;
}
function getItems($plz) {
$query = "SELECT * FROM user_bivmetal_bivmetal WHERE plz LIKE '".$plz."%'";
$res = mysql(TYPO3_db,$query);
$out=array();
while($row = mysql_fetch_assoc($res)) {
$out[]=$row;
}
return $out;
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/user_bivmetal/pi1/class.user_bivmetal_pi1.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/user_bivmetal/pi1/class.user_bivmetal_pi1.php']);
}
?>
Vielen Dank im Voraus,
Andrea