EvTwitter Plugin
================

Authors: Andy Carter


Introduction
------------

Connects to Twitter and retrieves the user's Twitter feed.


Installation
------------

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

	composer require evoluted/twitter

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 EvTwitter

Add the following to the plugin load array in 'app/Config/bootstrap.php':-

	'EvTwitter' => array('bootstrap' => true)

To setup the plugin's config create a new config file 'app/Config/Plugin/ev_twitter.php' with the following:-

$config = array(
	'EvTwitter' => array(
		'consumerKey' => 'XXX',
		'consumerSecret' => 'XXX'
	)
);

Without this file the plugin will throw an exception as these are required to use it.


Using EvTwitter Plugin
-----------------------

First, you will need to connect your application to Twitter. This can be done in one of two ways:

GLOBAL:
This is for sites which just have the one Twitter feed. Go to the URL "/admin/ev_twitter/twitter_connect" and just follow the setup.

ITEM-BASED:
You can set up Twitter feeds for specific items/pages on your site. The URL you will need to go to is /admin/ev_twitter/twitter_connect/index/__MODEL__/__MODELID__
Where:
__MODEL__ is the name of the model you're connecting
__MODELID__ is the ID of the model you're connecting

To include a Twitter feed on a page include the following in your controller:-

	$this->loadModel('EvTwitter.TwitterFeed');
	$this->set('twitter', $this->TwitterFeed->getFeed());
	
The function getFeed() accepts 2 parameters, both optional:
	$limit(int) - The number of Tweets you wish to pull out
	$conditions(array) - a standard Cake find parameter array [example: array('conditions'=>array('model'=>'foo', 'model_id'=>2))]