Einzelnen Beitrag anzeigen
  #6  
Alt 04.11.07, 09:35
chapolote chapolote ist offline
Forum Newbie
 
Registriert seit: 31.10.07
Beiträge: 42

Hallo,

bin zwar auch noch nicht ganz durch, aber bislang funktioniert es mit diesen Schritten (bislang für ein einseitiges Formular) ganz prächtig:

1. die Extension installieren

2. auf der entsprechenden Seite ein Plugin einfügen und Mailformplus auswählen. Soll das Formular in verschiedenen Sprachen ausgegeben werden hier bei Sprachen:alle auswählen

3. In der Plugin-Konfiguration ein template auswählen, hier mal ein Template von mir

HTML-Code:
####################################
#                                  #
# ext: th_mailformplus             #
#                                  #
# by:         Dev-Team             #
# email:      dev@typoheads.at     #
# www:        www.typoheads.at     #
#                                  #
# donations welcome :smile:             #
#                                  #
####################################

<!-- ###TEMPLATE_FORM### begin -->
###ERROR###
<form name="Formular" method="post" action="###REL_URL###" enctype="multipart/form-data"> <fieldset class="mfp"> <legend class="mfp">###LLL:title###</legend> <p class="mfp_legend">###LLL:fill_order###</p> <p class="mfp_small">###LLL:advice###</p> <input type="hidden" name="id" value="###PID###" /> <input type="hidden" name="submitted" value="1" /> <input type="hidden" name="L" value="###value_L###" /> <input type="hidden" name="type" value="###value_type###" /> <label for="forename" accesskey="n" class="mfp">###LLL:forename###</label>
        ###error_forename###
        <input type="text" name="foreame" id="forename" value="###value_forename###" class="mfp" tabindex="1"/><br /> <label for="name" accesskey="s" class="mfp">###LLL:surname###</label>
        ###error_name###
        <input type="text" name="name" id="name" value="###value_name###" class="mfp" tabindex="2"/><br /> <label for="email" accesskey="e" class="mfp">###LLL:email###</label>
        ###error_email###<input type="text" name="email" id="email" value="###value_email###" class="mfp" tabindex="3"/><br /> <label for="phone" accesskey="p" class="mfp">###LLL:phone###</label>
        ###error_phone###
        <input type="text" name="phone" id="phone" value="###value_phone###" class="mfp" tabindex="4"/><br /> <label for="topic" accesskey="t" class="mfp">###LLL:topic###</label> <select name="topic" tabindex="5" class="mfp"> <option value="###LLL:topic1###" ###selected_topic_mitteilung###>###LLL:topic1###</option> <option value="###LLL:topic2###" ###selected_topic_fragen###>###LLL:topic2###</option> <option value="###LLL:topic3###" ###selected_topic_privat###>###LLL:topic3###</option> <option value="###LLL:topic4###" ###selected_topic_sonstiges###>###LLL:topic4###</option> <option value="###LLL:topic5###" ###selected_topic_webmaster###>###LLL:topic5###</option> </select><br /><br /> <label for="text" accesskey="c" class="mfp">###LLL:text###</label> <textarea cols="50" rows="5" name="text" id="text" style="width:320px;" class="mfp" tabindex="6">###value_text###</textarea><br /><br />
    
        ###LLL:contactform###<br/><br/> <label for="contact_email">###LLL:email###</label> <input tabindex="7" type="radio" name="contact_via" value="email" id="contact_email" style="border-style:none;" ###checked_contact_via_email###> <label for="contact_phone" class="mfp_radio">###LLL:phone_radio###</label> <input tabindex="8" type="radio" name="contact_via" value="phone" id="contact_phone" style="border-style:none;" ###checked_contact_via_phone### /> <hr class="mfp" /> <b>###LLL:reference###</b><br/><br/> <label for="reference" accesskey="c" class="mfp"></label> <select name="reference" tabindex="9" class="mfp"> <option value="###LLL:reference1###" ###selected_reference_leer###>###LLL:reference1###</option> <option value="###LLL:reference2###" ###selected_reference_freunde###>###LLL:reference2###</option> <option value="###LLL:reference3###" ###selected_reference_link###>###LLL:reference3###</option> <option value="###LLL:reference4###" ###selected_reference_google###>###LLL:reference4###</option> <option value="###LLL:reference5###" ###selected_reference_suchmaschine###>###LLL:reference5###</option> </select><br /> <hr class="mfp" /> <!-- Start Upload Files
        
        <br />please send us your photo...<br/> <label for="photo" accesskey="f">Photo:</label><br/>
        number of allowed files: ###photo_numberOfAllowedFiles###<br/>
        allowed file types: ###photo_fileTypes###<br/>
        allowed file size per picture: ###photo_fileSize###<br/>
        already uploaded files: ###photo_numberOfUploadedFiles###<br/>
        remaining files: ###photo_numberOfRemainingFiles###<br/>
        ###error_photo######value_photo###<input type="file" name="photo" id="photo" size="20" maxlength="50000" accept="image" tabindex="9"/><br/> <br/> <label for="cv" accesskey="v">CV:</label><br/>
        number of allowed files: ###cv_numberOfAllowedFiles###<br/>
        allowed file types: ###cv_fileTypes###<br/>
        allowed file size per file: ###cv_fileSize###<br/>
        already uploaded files: ###cv_numberOfUploadedFiles###<br/>
        remaining files: ###cv_numberOfRemainingFiles###<br/>
        ###error_cv######value_cv###<input type="file" name="cv" id="cv" size="20" maxlength="50000" accept="*.pdf,*.doc" tabindex="10"/> <br/>
        
        End Upload Files --> <div class="center"> <input type="submit" value="###LLL:submit###" class="mfp" tabindex="10"/> </div> <!--###ADDITIONAL_MULTIPAGE###--> </fieldset> </form> <!-- ###TEMPLATE_FORM### end --> <!-- ###TEMPLATE_PRINT### begin -->
You just filled out the following fields:<br/>
Name: ###name###<br/>
Subject: ###subject###<br/> <br/>
you uploaded the following files:<br/>
###photo###
<br/>
###cv###
<br/> <!-- ###TEMPLATE_PRINT### end --> <!-- ###TEMPLATE_SUBMITTED_OK### begin
  OPTIONAL - will be shown if form was submitted and all required fields were filled out
--> <b>Thank you, your request will be answered soon.</b>
you have uploaded the following files:<br/> <hr>
###photo###<br/> <!-- ###TEMPLATE_SUBMITTED_OK### end --> <!-- ###TEMPLATE_EMAIL_USER### begin
    OPTIONAL - this will be the email text that is sent to the user (plaintext!)
-->
Hello ###name### (plain),
You have just filled out the form and asked about:
###subject###

you uploaded the following files:
###photo###

###cv###
We will contact you as soon as possible,
ciao!
<!-- ###TEMPLATE_EMAIL_USER### end --> <!-- ###TEMPLATE_EMAIL_USER_HTML### begin
    OPTIONAL - this will be the email text that is sent to the user (html!)
-->
Hello ###name### (html),<br/>
You have just filled out the form and asked about:<br/>
###subject###<br/> <br/>
you uploaded the following files:<br/>
###photo###<br/> <br/>
###cv###
<br/>
We will contact you as soon as possible,<br/>
ciao!
<!-- ###TEMPLATE_EMAIL_USER_HTML### end --> <!-- ###TEMPLATE_EMAIL_RECEIVER### begin
    OPTIONAL - this will be the email text that is sent to the admin (html!)
    (admin-email = the email you can specify in the mailformplus plugin)
-->
Hello admin (plain),
A user just filled out the form:
name: ###name###
subject: ###subject###

uploaded files:
###photo###

###cv###

please contact the user: ###email###
<!-- ###TEMPLATE_EMAIL_RECEIVER### end --> <!-- ###TEMPLATE_EMAIL_RECEIVER_HTML### begin
    OPTIONAL - this will be the email text that is sent to the admin (plaintext!)
    (admin-email = the email you can specify in the mailformplus plugin)
-->
Hello admin (html),<br/>
A user just filled out the form:<br/>
name: ###name###<br/>
subject: ###subject###<br/> <br/>
uploaded files:<br/>
###photo###
<br/>
###cv###
<br/>
please contact the user: ###email###<br/> <!-- ###TEMPLATE_EMAIL_RECEIVER_HTML### end --> <!-- ###TEMPLATE_ERROR### begin --> <!-- ###ERROR_START### begin 
this is used for the global error marker ###ERROR### -->
The following errors occured:
<ul> <!-- ###ERROR_START### end --> <!-- ###ERROR_END### begin 
this is used for the global error marker ###ERROR### --> </ul> <!-- ###ERROR_END### end --> <!-- ###ERROR_FILESIZE### begin 
this is used if you use the file upload functionality --> <li>File is too large!</li> <!-- ###ERROR_FILESIZE### end --> <!-- ###ERROR_FILETYPE### begin 
this is used if you use the file upload functionality --> <li>File is not allowed!</li> <!-- ###ERROR_FILETYPE### end --> <!-- ###ERROR_name### begin --> <li>insert Title</li> <!-- ###ERROR_name### end --> <!-- ###TEMPLATE_ERROR### end -->
4. Plugin Konfigurieren:

E-Mail: hier gibst Du die Adresse an, an die die Mitteilung geschickt werden soll
Betreff: hier den Betreff
Name des Absenders: hier den Namen des Absenders, wobei das bei mir nicht so recht funktioniert, d.h. geb ich hier z.B. Hans Huber ein steht dann in der Mail, die ich bekommen Absender hans@kasserver.com, huber@kasserver.com, stört aber erst einmal nicht
Redirect Seite: hier kann man eine Seite angeben, die angezeigt wird, wenn die Mail erfolgreich versendet wurde. Funktioniert bei mir bislang nicht, warum weiß ich noch nicht. Wenn man es leer läßt, wird die Bestätigungsmeldung eben anstelle des Mailformulares angezeigt. Damit kann ich erst einmal leben.
Pflichtfeld: einfach durch Komma trennen, also z.B. forename,name,email,text (Felder aus meinem Beispiel)
Bestätigungsmail: email (damit bekommt der User eine Mail an die angegebene Adresse)
Betreff der Bestätigungsmail: naja, einen Betreff angeben, Lokalisierung dieses Punktes geht wohl über Typoscript, soweit bin ich noch nicht...

Somit steht das Formular, sieht natürlich noch beschissen aus und kann nach Geschmack mit css positioniert werden.
Jedenfalls ist es voll funktionsfähig, was jetzt noch zu machen ist, ist:

-die Mailausgaben zu konfigurieren
-die Lokalisierung, sofern man verschiedene Sprachen anbieten will

Fangen wir mal mit der Lokalisierung an:

Oben im Quelltext sieht man Marker wie: ###LLL:email### oder ###LLL:phone###

Alle Marker dieser Art werden in die jeweilige Sprache übersetzt, vorausgesetzt es gibt eine locallang.php, in der die Marker definiert wurden.
Hier mal ein Beispiel von mir, hier wird die Standartsprache Deutsch und Englisch als 2. Sprache definiert:

PHP-Code:
<?PHP
$LOCAL_LANG 
= Array (
'default' => Array (
'title' => 'Kontaktformular',
'forename' => 'Vorname',
'surname' => 'Nachname',
'email' => 'Mail',
'phone' => 'Telefon',
'phone_radio' => '  Telefon',
'topic' => 'Betreff',
'text' => 'Nachricht',
'contactform' => 'Bitte kontaktieren Sie mich per: ',
'submit' => 'Absenden',
'topic1' => 'Mitteilung an Feeling Kenya',
'topic2' => 'Fragen zu Feeling Kenya ',
'topic3' => 'Private Nachricht',
'topic4' => 'Sonstige Anliegen',
'topic5' => 'Mitteilung an den Webmaster',
'reference' => 'Wie sind Sie auf uns aufmerksam geworden?',
'reference1' => 'Keine Angabe',
'reference2' => 'Empfehlung von Freunden',
'reference3' => 'Link von anderer Seite ',
'reference4' => 'Google',
'reference5' => 'andere Suchmaschine',
'mailform_sent' => 'Vielen Dank. Ihre Anfrage wurde versendet.<br/>Wir werden schnellstmöglich mit Ihnen Kontakt aufnehmen.',
'greeting' => 'Guten Tag Herr/Frau',
'mail_begin' => 'Sie haben soeben folgende Anfrage an uns gesendet:',
'mail_end' => 'Wir werden schnellstmöglich mit Ihnen Kontakt aufnehmen.',
'mail_bye' => 'Vielen Dank, Ihr Feeling Kenya Team.',
'fill_order' => 'Bitte alle Felder ausfüllen.',
'advice' => 'Ihre Daten werden keinenfalls von uns an Dritte weiter gegeben!',
'error_hint' => 'Folgende Felder sind nicht ausgefüllt:',
'forename_hint' => 'Vorname',
'name_hint' => 'Nachname',
'mail_hint' => 'E-Mail',
'phone_hint' => 'Telefon',
'text_hint' => 'Mitteilung',
),

'en' => Array (
'title' => 'Contactform',
'forename' => 'First name',
'surname' => 'Last name',
'email' => 'Email',
'phone' => 'Phone',
'phone_radio' => '  Phone',
'topic' => 'Subject',
'text' => 'Message',
'contactform' => 'Please contact me via: ',
'submit' => 'Submit',
'topic1' => 'Message to Feeling Kenya',
'topic2' => 'Inquiry to Feeling Kenya',
'topic3' => 'Private Message',
'topic4' => 'Other Issue',
'topic5' => 'Message at the Webmaster',
'reference' => 'How did you notice our Website?',
'reference1' => 'No statement',
'reference2' => 'Recommendation of friends',
'reference3' => 'Link from other website ',
'reference4' => 'Google',
'reference5' => 'Other searchengine',
'mailform_sent' => 'Thank you, your request will be answered soon.',
'greeting' => 'Hello Mr/Mrs',
'mail_begin' => 'You have just sent us the following request:',
'mail_end' => 'We will contact you as soon as possible.',
'mail_bye' => 'Thank you a lot, your Feeling Kenya Team.',
'fill_order' => 'Please fill out all fields.',
'advice' => 'We will treat your personal informations in confidence!',
'error_hint' => 'Please, complete the following fields:',
'forename_hint' => 'First name',
'name_hint' => 'Last name',
'mail_hint' => 'Email',
'phone_hint' => 'Phone',
'text_hint' => 'Message',
),

);
?>
Das ist eigentlich ganz simpel. Jetzt speichert man die Datei noch ab, beispielsweise unter fileadmin/templates/mailformplus.

Was jetzt noch fehlt, ist mailformplus anzuweisen, wo es die php-Datei findet. Also, für die Seite, ein Extension-Template erstellen und im Setup folgende Zeile einfügen:

Typoscript-Code:
1:
plugin.tx_thmailformplus_pi1.langFile = fileadmin/templates/mailformplus/locallang.php
Somit ist das Formular jetzt mehrsprachig.

Was jetzt noch konfiguriert werden muß, ist das Aussehen der Mails an den User bzw an den Betreiber der Webseite und die Bestätigungsmeldung nach erfolgreichem Absenden. Dieses erledigt sich alles im Mailformplus-Template. Wenn Ihr euch das nochmal anschaut gibt es da einen Abschnitt wie:

HTML-Code:
<!-- ###TEMPLATE_SUBMITTED_OK### begin
  OPTIONAL - will be shown if form was submitted and all required fields were filled out
--> <b>Thank you, your request will be answered soon.</b>
you have uploaded the following files:<br/> <hr>
###photo###<br/> <!-- ###TEMPLATE_SUBMITTED_OK### end --> <!-- ###TEMPLATE_EMAIL_USER### begin
    OPTIONAL - this will be the email text that is sent to the user (plaintext!)
-->
Hello ###name### (plain),
You have just filled out the form and asked about:
###subject###

you uploaded the following files:
###photo###

###cv###
We will contact you as soon as possible,
ciao!
<!-- ###TEMPLATE_EMAIL_USER### end --> <!-- ###TEMPLATE_EMAIL_USER_HTML### begin
    OPTIONAL - this will be the email text that is sent to the user (html!)
-->
Hello ###name### (html),<br/>
You have just filled out the form and asked about:<br/>
###subject###<br/> <br/>
you uploaded the following files:<br/>
###photo###<br/> <br/>
###cv###
<br/>
We will contact you as soon as possible,<br/>
ciao!
<!-- ###TEMPLATE_EMAIL_USER_HTML### end --> <!-- ###TEMPLATE_EMAIL_RECEIVER### begin
    OPTIONAL - this will be the email text that is sent to the admin (html!)
    (admin-email = the email you can specify in the mailformplus plugin)
-->
Hello admin (plain),
A user just filled out the form:
name: ###name###
subject: ###subject###

uploaded files:
###photo###

###cv###

please contact the user: ###email###
<!-- ###TEMPLATE_EMAIL_RECEIVER### end --> <!-- ###TEMPLATE_EMAIL_RECEIVER_HTML### begin
    OPTIONAL - this will be the email text that is sent to the admin (plaintext!)
    (admin-email = the email you can specify in the mailformplus plugin)
-->
Hello admin (html),<br/>
A user just filled out the form:<br/>
name: ###name###<br/>
subject: ###subject###<br/> <br/>
uploaded files:<br/>
###photo###
<br/>
###cv###
<br/>
please contact the user: ###email###<br/> <!-- ###TEMPLATE_EMAIL_RECEIVER_HTML### end --> 
###TEMPLATE_SUBMITTED_OK### ist also der Abschnitt, der die Bestätigungsmeldung definiert. Will man die lokalisieren, könnte der z.B. so aussehen:

HTML-Code:
<!-- ###TEMPLATE_SUBMITTED_OK### begin
  OPTIONAL - will be shown if form was submitted and all required fields were filled out
--> <b>###LLL:mailform_sent###</b> <!-- ###TEMPLATE_SUBMITTED_OK### end -->
Die Übersetzung hierzu steht dann wieder in der locallang.php.

Jetzt noch ein Beispiel dafür, wie die E-Mail konfiguriert und lokalisiert werden kann, wobei man immer darauf achten muß, daß sowohl eine plain-Text als auch eine html-Email konfiguriert werden muß. Auch hier ein Beispiel:

HTML-Code:
<!-- ###TEMPLATE_EMAIL_USER### begin
    OPTIONAL - this will be the email text that is sent to the user (plaintext!)
-->
###LLL:greeting### ###forename### ###name###,

###LLL:mail_begin###

###LLL:topic### ###topic###

###text###

###LLL:mail_end###
###LLL:mail_bye###
<!-- ###TEMPLATE_EMAIL_USER### end --> <!-- ###TEMPLATE_EMAIL_USER_HTML### begin
    OPTIONAL - this will be the email text that is sent to the user (html!)
-->
###LLL:greeting### ###forename### ###name###,<br/><br />
###LLL:mail_begin###<br/><hr />
###LLL:topic### ###topic###<hr/>

###text###<br/> <br/>
###LLL:mail_end###<br />
###LLL:mail_bye###
<!-- ###TEMPLATE_EMAIL_USER_HTML### end -->
Soweit so gut, wo ich jetzt noch dran bin, ist, die Error-Meldungen zu Lokalisieren, da geht zwar eigentlich analog zu obigem Vorgehen, funktioniert aber noch nicht 100%. Hier muß man meines wissens Typo-Script bemühen.

Ich hoffe ich hab Euch ein wenig weitergeholfen. Mailformplus ist zwar gut dokumentiert, aber schon verwirrend und man muß bei manchen Sachen 3x hinschauen, bevor man weiß, was was bedeutet. Jedenfalls hilft immer mal wieder ein Blick in die Doku zur Extension.

Gruß, chapolote
Mit Zitat antworten