[TYPO3-german] PHP-Problem mit MailformPlus
Detlef Fluess
fluess at 2-ad.de
Wed Apr 12 16:26:43 CEST 2006
Hallo,
ich habe für MailformPlus eine XCLASS angefangen.
Leider stehe ich noch vor EINER Hürde.
Es geht um die Funktion "function main($content, $conf)"
Kann mir jemand einen Tipp geben?
DANKE! :-)
###
[code]
[php]
function main($content, $conf) {
$this->pi_loadLL();
global $TSFE; // new in release 2.2: automatic "no-cache" pagesetting
$TSFE->set_no_cache();
$this->conf = $conf;
$this->get_post = array_merge(t3lib_div::_GET(), t3lib_div::_POST());
$this->debug = $this->conf['saveDB.']['debug'];
switch((string)$conf["CMD"]) {
case "singleView":
print "singleView<br>";
list($t) = explode(":", $this->cObj->currentRecord);
$this->internal["currentTable"] = $t;
$this->internal["currentRow"] = $this->cObj->data;
return $this->pi_wrapInBaseClass($this->singleView($content, $conf));
break;
default:
$mailformplus_id = $this->cObj->data['pages'];
# default: display the form from the page where the plugin is inserted
if (!$mailformplus_id) $mailformplus_id = $this->cObj->data['pid'];
// Initializing the query parameters:
$query = "SELECT tx_thmailformplus_main.* FROM tx_thmailformplus_main WHERE pid IN (".$mailformplus_id.") LIMIT 0,1";
$res = $GLOBALS['TYPO3_DB']->sql(TYPO3_db, $query);
if (mysql_error()) debug(array(mysql_error(), $query));
$this->internal["currentTable"] = "tx_thmailformplus_main";
$this->internal["currentRow"] = mysql_fetch_array($res);
#############
# template
#############
t3lib_div::loadTCA('tx_thmailformplus_main');
$config = $GLOBALS['TCA']['tx_thmailformplus_main'];
$template_folder = $config[columns][email_htmltemplate][config][uploadfolder];
$this->templateCode_orig = $this->cObj->fileResource($template_folder.'/'.$this->getFieldContent("email_htmltemplate"));
##################################################################################################
# Form was submitted
if (t3lib_div::GPvar("SUBMITTED") || t3lib_div::GPvar("submitted")) {
$this->loadMapping($conf);
$this->templateCode_error = $this->cObj->getSubpart($this->templateCode_orig, "###TEMPLATE_ERROR###");
$error = $this->check_form($content, $conf);
if ($error) {
# self defined error message start
$temp = $GLOBALS["TSFE"]->cObj->getSubpart($this->templateCode_error, "ERROR_START");
if ($temp) {
$error = $temp.$error;
} else {
$error = 'Please fill out the following fields: <ul>'.$error.'</ul>';
}
# self defined error message end
$temp = $GLOBALS["TSFE"]->cObj->getSubpart($this->templateCode_error, "ERROR_END");
if ($temp) {
$error .= $temp;
}
$this->error = $error;
$this->templateCode = $this->cObj->getSubpart($this->templateCode_orig, "###TEMPLATE_FORM###");
### wenn nächste Seite vorhanden
if ($this->getFieldContent("tx_dfmailformplusext_form_next") != "") {
return $this->show_form($content, $conf).$this->set_form_next_submit($content, $conf);
}
### wenn KEINE nächste Seite vorhanden
return $this->show_form($content, $conf).$this->set_form_submit($content, $conf);
} else {
####################################################################
### Das funktioniert hier nicht - begin
### Es wird zwar "$this->set_form_next_submit($content, $conf)" ausgegeben
### aber "$this->show_form($content, $conf)" davor nicht.
### bei den anderen Abfragen klappt das aber!
### Ich möchte das versenden der Mail _abfangen_, wenn die Bedingiung erfüllt ist.
###########################
if ($this->getFieldContent("tx_dfmailformplusext_form_next") != "") {
return $this->show_form($content, $conf).$this->set_form_next_submit($content, $conf);
}
### Das funktioniert hier nicht - end
#####################################################################
$this->templateCode = $this->cObj->getSubpart($this->templateCode_orig, "###TEMPLATE_SUBMITTED_OK###");
$this->templateCode_useremail = $this->cObj->getSubpart($this->templateCode_orig, "###TEMPLATE_EMAIL_USER###");
$this->templateCode_receiver = $this->cObj->getSubpart($this->templateCode_orig, "###TEMPLATE_EMAIL_RECEIVER###");
$this->send_form($content, $conf);
return $this->templateCode;
}
} else {
$this->templateCode = $this->cObj->getSubpart($this->templateCode_orig, "###TEMPLATE_FORM###");
# compatibility to old version (no placeholder specified)
if (!$this->templateCode) $this->templateCode = $this->templateCode_orig;
if ($this->getFieldContent("tx_dfmailformplusext_form_next") != "") {
return $this->show_form($content, $conf).$this->set_form_next_submit($content, $conf);
}
return $content .= $this->show_form($content, $conf).$this->set_form_submit($content, $conf);
}
break;
}
}
########
[/php]
[/code]
More information about the TYPO3-german
mailing list