Placid is a Craft plugin which makes it easy to use REST services in your twig templates, whether thats getting a twitter feed, showing off dribbble shots or getting the weather, Placid has you covered.
Installing
- Download the latest release and unzip
- Upload the placid directory to craft/plugins
- Install in admin area
Updating
- Download the latest release and unzip
- Replace placid directory in craft/plugins
- Refresh admin section and run the update
Whats new in 1.2.5
- You can now make requests via AJAX
- There is an
onBeforeRequestEvent - There is an
onAfterRequestEvent - You can now specify the cache duration using the
durationconfig in your template - The way Placid works has been rewritten for better compatibility with Guzzle
- There is a new tag,
craft.placid.request(handle)(does the same as .get() but will be more futureproof) - You can now set the
methodof the request (templates only right now) - Failed requests are handled gracefully and don't stop templates loading
Changes in 1.2.5
- Segments defined in the template will now override the segments set in the admin area
This example assumes you have a twitter request set up and authenticated using OAuth, for other examples see here
craft.placid.request(requestHandle)
This is the main placid variable, use this to get the data from the request.
{% set timeline = craft.placid.request('twitterFeed') %}
{% for tweet in timeline %}
{{ tweet.text }}
{% endfor %}
cache(bool) - Whether or not to cache the request, default is trueduration(number) - The length of time in seconds to cache the request, default is whatever is in your default configquery(array) - An array of key/value pairs to set in the query stringmethod(string) - What method to use for the request, default isGETsegments(string) - The segments to use in the request, overrides any set in admin
For full instructions on how to use, refer to docs
