Wednesday 19 December 2007 8:44:00 pm
The settings/collect.ini file contains some useful form options.
Recall from the first article in this series that eZ Publish reads basic settings from the default INI files, which are overriden by any settings in the specific siteaccess overrides, which are overridden by settings in the global override files. You should never modify the default INI files.
The settings below should be created in the file collect.ini.append.php located either:
If the override file does not already exist, you must create it.
The sections below show the settings that need to be included in the INI file. Note that lines starting with hash symbols are comments.
The setting below specifies that there is an information collector based on the class ID “membership_application_form”, and that the identifier for the information collector is the same as the class name.
[InfoSettings] # Matches class id or identifier to information collection type TypeList[membership_application_form]=membership_application_form
Sometimes it is useful to send an email summarizing the results of each form submission. This is not required for objects such as polls, but we will use it in our membership application form.
[EmailSettings] # Matches class id or identifier to information collection type # SendEmailList[poll]=disabled SendEmailList[membership_application_form]=enabled
The DisplayList setting specifies the page that should be loaded after the form is submitted. There are three main options:
[DisplaySettings] # result - Display IC result, for instance poll result or your form data # redirect - Redirect to a specific url # node - Redirect back to content node # Matches class id or identifier to information collection type #DisplayList[poll]=result DisplayList[membership_application_form]=result
Some forms need to be available to anonymous users. This is determined by the setting below.
[CollectionSettings] # if enabled then information from anonymous users can be collected # CollectAnonymousData=enabled # Same as CollectAnonymousData but is a list of IC types and # their override settings, if specified it will override default setting CollectAnonymousDataList[membership_application_form]=enabled
The CollectionUserData setting specifies how to handle users submitting a form multiple times, and is explained well in the comments to the setting.
eZ Publish does not automatically include objects of a new class in the default top or left site menus. For example, the top menu displays the objects that are directly below the top-level node of the Content branch, but only for the classes specified in menu.ini. Similarly, the left menu displays the objects that are directly below the second-level node that is currently being viewed, but also only for the classes specified in menu.ini. The new Membership Application Form class needs an entry in the relevant menu.ini file.
This example uses the Website Interface extension, so either of these settings override files can be edited:
The entries added are shown below.
This may not be necessary for all forms if you do not need them to be visible in the top or left menus (for example, if you are just going to link to the form in the body of an article). In our case, we have added the appropriate entries to both the TopIdentifierList setting (objects of these classes are shown in the flat_top menu template at extension/ezwebin/design/ezwebin/templates/menu/flat_top.tpl), and the LeftIdentifiersList setting (objects of these classes are shown in the flat_left menu template at extension/ezwebin/design/ezwebin/templates/menu/flat_left.tpl).
Without an override template, eZ Publish will use the /node/view/full.tpl template to display the form, but that template does not include the elements required to display and process the form properly.
To point eZ Publish to the correct template (which we will create next), edit the override.ini.append.php file for each siteaccess, such as the “eng” siteaccess:
Add the following entry to the override file:
[full_membership_application_form] Source=node/view/full.tpl MatchFile=full/membership_application_form.tpl Subdir=templates Match[class_identifier]=membership_application_form