ich steh hier echt etwas auf dem schlauch. ich habe ein kontaktmodul umgebaut zum callbackmodul (also nur name und tel). dieses modul nutzt die datei callback.html, callback2.html und callback_error.html.
in callback_error soll die ausgabe generiert werden für fehler. hier das modul:
Code: Alles auswählen
<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname : Contact form
* Author(s) : Andreas Lindner
* Copyright : Contenido - four for business
* Created : 12.08.2005
************************************************/
#Includes
cInclude("classes", "class.phpmailer.php");
if (!isset ($_POST['send'])) {
#Form has not been sent yet
cInclude('classes', 'class.article.php');
cInclude('classes', 'class.template.php');
#Create contact form
echo '<form name="callbackform" id="callbackform" method="post" action="'.$sess->url("front_content.php?idcat=$idcat&idart=$idart&parentid=$parentid").'">';
echo '<input type="hidden" name="send" value="1">';
if (!is_object($tpl)) {
$tpl = new Template;
}
$tpl->set("s", "NAME", mi18n("Name"));
$tpl->set("s", "TELEFON", mi18n("Telefon"));
$tpl->set("s", "PFLICHTFELDER", mi18n("Pflichtfelder"));
$tpl->set("s", "ABSCHICKEN", mi18n("Abschicken"));
$tpl->generate($cfgClient[$client]["path"]["frontend"]."templates/callbackformular.html");
echo '</form>';
} elseif ($_POST['send'] == 1) {
#Form has been sent
#Check user input
$noerrors = true;
$msg = '';
if ($_POST['Nachname'] == '') {
$noerrors = false;
$msg .= mi18n("Bitte geben Sie Ihren Namen ein!")."'<br/>";
}
if ($_POST['Telefon'] == '') {
$noerrors = false;
$msg .= mi18n("Bitte geben Sie Ihre Telefonnummer ein!")."'<br/>";
}
if ($noerrors == false) {
#Errors have been found
$tpl->generate($cfgClient[$client]["path"]["frontend"]."templates/callback_error_formular.html");
#echo mi18n("Beim Versenden sind folgende Fehler aufgetreten:")."<br/>";
#echo $msg.'<br/>';
#echo '<a href="javascript:history.back();">'.mi18n("Zurück").'</a>';
} else {
#No errors, create and send mail
$mail = new phpmailer;
$mail_body = '<html><head></head><body bgcolor="#ffffff"><table cellspacing="0" cellpadding="2" border="0">';
if (is_array($_POST)) {
foreach ($_POST as $key => $value) {
if ($key != 'send') {
$mail_body .= "<tr><td>$key</td><td>$value</td></tr>";
}
}
}
$mail_body .= '</table></bo'.'dy></html>';
$mail->Host = "localhost";
$mail->IsHTML(true);
#Get mailer from settings
switch (strtolower("CMS_VALUE[4]")) {
case "smtp" :
$mail->IsSMTP();
$host = "CMS_VALUE[5]";
$user = "CMS_VALUE[6]";
$password = "CMS_VALUE[7]";
if (($host != '') && ($user != '') && ($password != '')) {
$mail-> $SMTPAuth = true;
$mail->Host = $host;
$mail->Username = $user;
$mail->Password = $password;
}
break;
case "mail" :
$mail->IsMail();
break;
case "sendmail" :
$mail->IsSendmail();
break;
case "qmail" :
$mail->IsQmail();
break;
default :
}
$mail->From = "CMS_VALUE[0]";
$mail->FromName = "CMS_VALUE[2]";
$mail->AddAddress("CMS_VALUE[1]", "");
$mail->Subject = "CMS_VALUE[3]";
$mail->Body = $mail_body;
$mail->WordWrap = 50;
$mail->Send();
#Display message after mail is sent
$tpl->generate($cfgClient[$client]["path"]["frontend"]."templates/callback2formular.html");
}
}
?>
Code: Alles auswählen
<table width="154" border="0" cellspacing="0" cellpadding="0" style="background-image:url(images/boxen/hg_kachel_box.gif); background-repeat:repeat-y">
<tr>
<td colspan="3"><img src="images/boxen/titel_callback.gif" width="154" height="18"></td>
</tr>
<tr>
<td width="6" rowspan="3"><img src="images/abstandshalter.gif" width="6" height="1"></td>
<td width="142"><img src="images/abstandshalter.gif" width="1" height="10"></td>
<td width="6" rowspan="3"><img src="images/abstandshalter.gif" width="6" height="1"></td>
</tr>
<tr>
<td class="box"><?php echo mi18n("Beim Versenden sind folgende Fehler aufgetreten:")."<br/>";
echo $msg.'<br/>';
echo '<a href="javascript:history.back();">'.mi18n("Zurück").'</a>';?></td>
</tr>
<tr>
<td><img src="images/abstandshalter.gif" width="1" height="4"></td>
</tr>
<tr bgcolor="#7F7F7F">
<td colspan="3"><img src="images/abstandshalter.gif" width="1" height="1"></td>
</tr>
</table><br>
"; echo $msg.'
'; echo ''.mZurück.'';?>
das ist alles was ich auf meiner website zu sehenbekomm. nun frag ich mich natürlich: wo liegt der fehler? ich finde ihn nicht. vielleicht bin ich auch nur blind oder hab irgendwas bei den php konventionen übersehen.
wer kann mir helfen?
gruesse rene