Introducing Contact Manager for Expression Engine 2
With the introduction of the long anticipated Expression Engine 2.0 beta, modules have already begun popping up all over the place, covering a multitude of functions. Although small in scope, we’re offering our first EE2 creation Contact Manager to the general public.
Contact Manager is a third-party module that allows developers to deploy a contact form anywhere on the website that then records data to a database and optionally emails subscribed members notification upon the contact form being submitted.
Download it here.
There are two tag pairs, in the form of
{exp:contactmanager:display_form} {/exp:contactmanager:display_form}
and
{exp:contactmanager:display_message}{/exp:contactmanager:display_message}
When deployed in a template, the “display_form” tag generates the following HTML:
<form id=”” class=”” action=”/index.php” method=“post”><input type=“hidden” name=“ACT” value=“41” /><input type=“hidden” name=“RET” value=”” /></form>
When you call the tag, it displays the above form. The form submits to the main index.php file which then uses the ACT hidden field’s action id to find the accept_contact() method, which then stores the POST variables in a database, and if set in the configuration, emails a notification to subscribed members. The page where the user is sent after submission can be overwritten entirely in the module’s configuration or specified directly in the script by applying the following parameter to the template’s display_form tag:
{exp:contactmanager:display_form return=“http://example.com/contact_success”}
Other parameters for the “display_form” tag include:
You must also define the sub tags that you are going to use. You can apply them like this:
<input type=“text” name=”{name}” />
They are:
The actual response is delivered via flashdata, session data available only to the next page, in a session object variable that is called by using the following function in the module (the module will automatically take care of this):
$this->EE->session->flashdata(‘system_message’)
If using AJAX for a response, you must first specify your intent to do so in the configuration. After you have changed the appropriate setting, upon submission a simple message is given back (via JSON encoded data). You can specify success and failure messages in the configuration, also.
You can optionally include the response message in the form itself by using the following parameter:
{exp:contactmanager:display_form message=“inset”}
If you would like to display the response message outside of the form, you can call the “display_message” tag pair.
When using this tag, you must declare one parameter. That parameter is “tagtype” (in which you declare the tag that will surround the AJAX message. It can be set like this:
{exp:contactmanager:display_message tagtype=“div”}{/exp:contactmanager:display_message}
This would display:
<div id=”” class=”“/> </div>
If AJAX is set to ON, it will display the tags regardless. If AJAX is OFF, it will only display the tag (with system message) if the flashdata exists.
Other parameters for the “display_message” tag include:
If using AJAX, you can then hide the given tag (via class, id, tag selector) until revealed when the AJAX gets a return.
We hope that you enjoy the module and look forwards to getting comments on it. If you have suggestions, feel free to suggest them. ContactManager is currently in BETA, so it will become more full-featured as time goes on.
When you focus too much on yourself and your opinions, one thing usually happens: No one seems to care.
Eight to ten page websites are a standard for most companies. It doesn't sound like a lot, but could it be too many?
Nothing streamlines a project better than an underlying plan.
How adding a single SEO keyword can get Google to like you better.