NAVIGATION
This shows you the differences between two versions of the page.
|
english:phpwcms-system:article:contentparts:form:special-applications:php-function-include [2010/07/14 15:52] Claus |
english:phpwcms-system:article:contentparts:form:special-applications:php-function-include [2018/06/03 18:09] (current) |
||
|---|---|---|---|
| Line 5: | Line 5: | ||
| - | Since the release of r282 it is possible to process an own PHP function between the action “submit” and “sending the E-Mail”. This function can read all the form input, modify, and return it. | + | Since the release of r282 it is possible to process an own PHP function between the action “submit” and “sending the E-Mail”. This function can read all the form input, modify, and return it. //(Also, the transmission destination (email address) may be changed)//. |
| + | **These changes are not recorded in the database, because the values were written into the database before the function is called.** | ||
| + | |||
| + | \\ | ||
| The function call must be registered in the form in the fields “php function:” below **"recipient template:"** or **"copy to - template:"**. //(See picture below)//. | The function call must be registered in the form in the fields “php function:” below **"recipient template:"** or **"copy to - template:"**. //(See picture below)//. | ||
| Line 64: | Line 67: | ||
| ===== Frontend-Output ===== | ===== Frontend-Output ===== | ||
| - | The corrected e-mail will be spent and delivered. | + | The corrected e-mail will be presented and delivered. |
| Line 148: | Line 151: | ||
| ===== Digression Functions / Variables ===== | ===== Digression Functions / Variables ===== | ||
| - | First the function for **"recipient - template ** //(" my_form_title_recipient_de ")// and in a second call the function for **"copy to - template** //( "my_form_title_copy_to_de")// is processed. At the order we have no control. | + | First the function for **"recipient - template ** //(" my_form_title_recipient_de ")// and in a second call the function for **"copy to - template** //( "my_form_title_copy_to_de")// is processed. At this time we cannot control the order. |
| A function call will be autom. pass the three arrays **$postvars, $form** and **$mail** //(see below)//. | A function call will be autom. pass the three arrays **$postvars, $form** and **$mail** //(see below)//. | ||
| Line 154: | Line 157: | ||
| **Example:** \\ | **Example:** \\ | ||
| - | The function call from the form with **"my_incredible_function"** expects the function | + | The function call from the form with **"my_incredible_function"** is expecting the function |
| function my_incredible_function( &$postvar, &$form, &$mail ) { .... } | function my_incredible_function( &$postvar, &$form, &$mail ) { .... } | ||
| - | in a file at the folder **template/inc_script/frontend_init/ ** | + | in a file within the folder **template/inc_script/frontend_init/ ** |
| Line 164: | Line 167: | ||
| These texts can be read, manipulated and written back now by php. \\ | These texts can be read, manipulated and written back now by php. \\ | ||
| - | After the functions were left the emails to the registered addresses are sent. | + | After processing of the functions the emails are sent to the registered addresses. |
| The database is already filled before calling the function, here the manipulated result is not recorded. | The database is already filled before calling the function, here the manipulated result is not recorded. | ||
| Line 502: | Line 505: | ||
| === $form['template'] and $form['template_copy'] === | === $form['template'] and $form['template_copy'] === | ||
| - | Interesting are here the two ranges $form['template'] and $form['template_copy'] those the finished email text contain. | + | Of interest are the two ranges $form['template'] and $form['template_copy'], they are containing the processed email text. |
| Both texts are identical, for simplicity, but could also be different. | Both texts are identical, for simplicity, but could also be different. | ||
| Line 531: | Line 534: | ||
| </file> | </file> | ||
| - | The correct personal address was substitute with the help of the script at the placeholder ##[%TITLE%]## in the emails To and CC. | + | The correct personal address was substituted with the help of the script by the placeholder ##[%TITLE%]## in the emails To and CC. |
| - | This text is now correctly send as email. | + | This text is now correctly sent as email. |
| \\ | \\ | ||
| Line 677: | Line 680: | ||
| The process described above can be very simply used to translate e-mail text using the i18n function [[english/phpwcms_replacer_rts/integrated-tags/language-tags/i18n]] of phpwcms. | The process described above can be very simply used to translate e-mail text using the i18n function [[english/phpwcms_replacer_rts/integrated-tags/language-tags/i18n]] of phpwcms. | ||
| - | Assumed we write the following e-mail template: | + | Assuming we'll write the following e-mail template: |
| @@Company@@: {company} \\ | @@Company@@: {company} \\ | ||
| @@Subject@@: {subject} | @@Subject@@: {subject} | ||
| - | and want to have @@Company@@ for German e-mail recipient //(e.g. for the email copy)// as "Firma" and/or @@Subject@@ as "Betreff" in the e-mail stand for. | + | and want to have @@Company@@ for German e-mail recipient //(e.g. for the email copy)// as "Firma" and/or @@Subject@@ as "Betreff" in the e-mail stands for. |
| Line 699: | Line 702: | ||
| **email_i18n_substitute_text** must be registered as function in backend/form cp as described above. \\ | **email_i18n_substitute_text** must be registered as function in backend/form cp as described above. \\ | ||
| - | Naturally also the appropriate language file must be translated in addition. | + | Naturally also the appropriate language file must be translated additionally. |
| \\ | \\ | ||
| \\ | \\ | ||