Skip to content

Commit

Permalink
Fixes #5
Browse files Browse the repository at this point in the history
  • Loading branch information
alecritson committed Sep 23, 2015
1 parent 0d56884 commit c987ea7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
9 changes: 9 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Placid allows you to consume RESTful APIs in your Statamic templates, using Guzz
- Access tokens

#### Updates / Changes
- **v1.0.2** - Fixes issue when an API returns an array and you was unable to access its values or loop it
- **v1.0.0** - Version 1, fixes and enhancements
- **v0.9.2** - Refactoring and added [API](#api) methods
- **v0.9** - Bug fixes, refactoring, added [default](#defaults) config and reusable [access tokens](#access_tokens)
Expand Down Expand Up @@ -93,6 +94,14 @@ To use this plugin in your templates, simply use these tags:

*If you are unsure as to what tags to use within the placid variable pair, just pop the api url into your browser and work it out from there*

If your API returns an array then Placid will automatically cast this to a `response` variable which you can loop over like:

{{ placid handle="tester" }}
{{ response }}
{{ some.value }}
{{ /response }}
{{ /placid }}

### Queries
You can add queries to the request from the template using a `key:value` pattern separated by commas (`,`), something like this:

Expand Down
9 changes: 6 additions & 3 deletions placid/pi.placid.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Plugin_placid extends Plugin {

var $meta = array(
'name' => 'Placid',
'version' => '1.0.0',
'version' => '1.0.2',
'author' => 'Alec Ritson',
'author_url' => 'http://www.alecritson.co.uk'
);
Expand Down Expand Up @@ -188,7 +188,11 @@ public function index()
if(!$result) {
return Parse::template($this->content, array('no_results' => true));
}


if(is_array($result))
{
return Parse::template($this->content, array('response' => $result));
}

return $result;
}
Expand All @@ -197,7 +201,6 @@ public function fetchParams($args)
{
foreach($args as $arg)
{

$options[$arg] = $this->fetchParam($arg, NULL, NULL, FALSE, FALSE);
}
return array_filter($options);
Expand Down

0 comments on commit c987ea7

Please sign in to comment.