sfContactFormPlugin
Overview
sfContactFormPlugin is a Symfony plugin. It allows you to have a simple contact form on your web site.
The contact form includes name, email and message; all these fields are required by validation. If you have the sfCryptographpPlugin installed, you can also have a captcha validation. Emails are sent in multipart format (text/html).
Screenshots
Installation
You can install sfContactFormPlugin via PEAR (recommended) package manager or manually.
- The easiest way to install sfContactFormPlugin is to use PEAR package manager.
$ symfony plugin-install http://plugins.symfony-project.com/sfContactFormPlugin
Alternatively, if you don't have PEAR installed, you can download the latest package attached to this plugin's wiki page and extract it under your project's plugins/ directory. You will also have to copy the contents of the myproject/plugins/sfContactFormPlugin/web/ directory into a myproject/web/sfContactFormPlugin/ directory.
- Now clear the cache with symfony clear-cache command to enable the autoloading to find the new classes:
$ symfony cc
- Enable the module in your application, via the settings.yml file.
// in myproject/apps/backend/config/settings.yml
all:
.settings:
enabled_modules: [default, sfContactForm]
Configuration
Put and customize the following settings inside your app.yml file.
// in myproject/apps/frontend/config/app.yml
all:
sfContactForm:
contact_module: frontend # Module to redirect after the email is sent
contact_action: contact # Action to redirect after the email is sent
mail_sent_msg: Thank you for contacting us!
use_cryptographp: true
captcha_intro: Please insert into the textbox the code you see in the picture below
mail_html_header: |
Dear webmaster, there is a new contact message from your website.<br />Here is the content:<br /><br />
mail_html_footer: |
<br /><br />Kind regards, your favorite website.
mail_txt_header: |
Dear webmaster, there is a new contact message from your website.
Here is the content:
mail_txt_footer: Kind regards, your favorite website.
mail_subject: New contact message
mail_recipient: admin@example.com
You can also customize the sfContactForm/web/css/contact.css stylesheet.
Validation
The sfContactFormPlugin comes with a very basic validation: every field is required, the email address must be valid, and in case sfCryptographpPlugin is enabled the validation code must be correct.
When usage of the sfCryptographpPlugin is set it checks app/setings.yml for:
all:
.settings:
enabled_modules: [default, cryptographp, ...]
If you like to change the validation rules, just modify the contact.yml validation file inside the /plugins/sfContactFormPlugin/modules/sfContactForm/validate folder. There you can also disable the fillin, which is enabled by default.
Usage
Before using sfContactForm helper you need to load it with use_helper statement.
<?php use_helper('sfContactForm'); ?>
then you can call the creation of the form anywhere in your template:
<?php contact_form() ?>
Changelog
2007-09-06: 0.1.0 alpha
- Initial release
2007-09-07: 0.1.0 alpha
Many thanks to Manuel 'EndelWar?' Dalla Lana for the suggestions
- Bug fix with cryptographp
- added the function contact_form() to the helper
2007-09-12: 0.2.0 beta
- Added a handful of css
- Added infos about validation in the doc
2007-10-04: 0.2.2 beta
- Some bugfix in the helper
- Added Polish translation (many thanks to Zbigniew Niedzielski for both)
Contacts
If you have any questions or feedback feel free to contact me at agiorg@gmail.com.
Please include sfContactFormPlugin in the mail subject, this will help me tracking the conversation.
License
sfContactFormPlugin is a symfony plugin created by Andrea Giorgini. For the full copyright and license information, please view the LICENSE file that was distributed with this source code.
Attachments
- sfContactFormPlugin-0.1.0.tgz (4.2 kB) - added by Andrea.Giorgini on 09/07/07 14:34:16.
- contact.png (9.5 kB) - added by Andrea.Giorgini on 09/10/07 13:24:22.
- sfContactFormPlugin-0.1.1.tgz (4.2 kB) - added by Andrea.Giorgini on 09/10/07 13:25:15.
- sfContactFormPlugin-0.2.0.tgz (4.4 kB) - added by Andrea.Giorgini on 09/12/07 14:25:59.
- sfContactFormPlugin-0.2.1.tgz (4.5 kB) - added by Andrea.Giorgini on 09/25/07 15:42:35.
- sfContactFormPlugin-0.2.2.tgz (4.9 kB) - added by Andrea.Giorgini on 10/04/07 10:30:27.
