This is an old revision of the document!


CP after form input

Certain content parts only deliver after filling out and sending a form.

FIXME better translate and [en]-images

There are some applications, with which only a form must be filled out before certain content parts for the side visitor to become available. A Login is not to be consulted for it.

In the field “on success” the tag {SHOW_CONTENT:CP,XX} is registered, with which the CPs after mailing the form are represented. In this field tags cannot be registered directly, since a safety mechanism removes all tags.

We can achieve however with the assistance of a PHP script, which uses a new function, our goal. (Available since release r282).

This function can read, change and return all form inputs. It puts itself temporally between the action submit and to dispatching the email.

<note tip> The entered data are changed with a function in the folder /frontend_init/.
Have a look: RT available in form generated E-Mail (Available since r282) </note>

Demonstrated here by the example of a simple form with a downstream CP:

  • Completing the form
  • Sending the form
  • Automatic call of CPs

The address of the CPs is not visible from the outside.

Docu: –
Forum: Galerie mit Formular verbinden[DE]

Autor: K.Heermann (flip-flop) (16.09.09)
CMS-Version: >= V1.4.1 r282
Version: V1.0 16.09.09

Condition:/config/phpwcms/conf.inc.php

  • $phpwcms['allow_ext_init'] = 1;




Frontend:

The form:

example.com/r366/index.php?kategorie01

The result:

example.com/r366/index.php?kategorie01#jumpForm1


Backend:

The CP "plain text":

- As an example for any other CP. (In a hidden area stored).

Simple form:

The script

in template/inc_sript/frontend_init/my_form_do_it.php

Here is an example of calling the content part with the ID=2

<?php
// -------------------------------------------------------------------------------------------
// obligate check for phpwcms constants
  if (!defined('PHPWCMS_ROOT')) {
    die("You Cannot Access This Script Directly, Have a Nice Day."); }
// -------------------------------------------------------------------------------------------
 
// Simple script for calling a CP from a form, after the submit
 
 
function my_form_do_it( &$postvar, &$form, &$mail ) {
 
    $form['onsuccess'] .= '{SHOW_CONTENT:CP,2}';
}
 
?>
english/phpwcms-system/article/contentparts/form/special-applications/cp-after-form-input.1253144676.txt.gz · Last modified: 2018/06/03 18:07 (external edit)
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0