Newsletter Signup Plugin
=========================

Simple plugin to let users signup to a sites newsletter. Admin provides a CSV export of the name / email address for admins to put into something like mailchimp.


Installation
=============

This is a composer plugin so from www/app just run composer as:-

	composer require evoluted/newsletterSignups --prefer-source

To setup the database use the CakeDC Migrations plugin. To run the migrations and setup the database run:-

	Console/cake Migrations.migration run all --plugin EvNewsletterSignups

Add the following code to the "CakePlugin::loadAll(" function array located in /app/Config/bootstrap.php:-

	'EvNewsletterSignups'=>array(
		'routes'=>true
	),

The full item should look something similar to this:-

	CakePlugin::loadAll(array(
		'DebugKit',
		'SiteSettings'=>array(
			'routes'=>true,
			'bootstrap'=>true,
			'configuration'=>'site_settings_config'
		),
		'Routable'=>array(
			'routes'=>true,
		),
		'Migrations',
		'Upload',
		'EvNewsletterSignups'=>array(
			'routes'=>true
		)
	));

Then to display on the site use the following code. (Data can be passed in for configuration, see below):-

	<?php echo $this->element('EvNewsletterSignups.form'); ?>

That's it. The plugin should work, both with and without Javascript.


Customisation
===============

Some parameters can be passed into the element function to customise the form without having to modify the template or redefine it.

<?php echo $this->element('EvNewsletterSignups.form', array()); ?>

'title' - This is echo'd above the form fields to be used as a title for the newsletter.
	E.G.
	'title' => '<h3 class="icon tag">Sign up for our exclusive offers</h3>'

'name_field' - This is passed straight to the input field of the 'name' input tag. All standard CakePHP input options can be passed apart from id. ID is unset from the array as we use that for the jQuery.
	E.G.
	'name_field' => array(
		'class' => 'input left replace required not-value',
		'value' => 'Name',
		'div' => false,
		'label' => false
	),

'email_field' - As above, but this is passed to the 'email' input field.
	E.G.
	'email_field' => array(
		'class' => 'input left replace required email',
		'value' => 'Email',
		'div' => false,
		'label' => false
	),

'submit_field' - As above, but this is passed to the Submit Button.
	E.G.
	'submit_field' => array(
		'class' => 'left button green',
		'div' => false
	)


Overwriting
============

If you need to actually overwrite any of the files, do so in line with the CakePHP plugin docs.
http://book.cakephp.org/2.0/en/plugins.html

If you need to overwrite the form element, copy the current element into the following location and modify this rather then the main plugin form element.

/app/View/Plugin/EvNewsletterSignups/Elements/form.ctp

CakePHP will automatically check that location first for the form template and load from there if it exists, if not it'll fall back to the one in the main plugin folder.

Same applies for either of the notification templates. Copy these into the following location before changing.

/app/View/Plugin/EvNewsletterSignups/Notifications/success.ctp
/app/View/Plugin/EvNewsletterSignups/Notifications/error.ctp

If you need to overwrite the css or the js for any reason, copy the files into the main webroot as below and modify as needed:

/app/webroot/ev_newsletter_signups/css/newsletter-notifications.css
/app/webroot/ev_newsletter_signups/js/newsletter-signup.js


Suggestions / Comments / Changes
=================================

Lemme know, or checkout the repo and do it yourself :)
