Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding JSON parameter to get_list method. #9

Closed
wants to merge 1 commit into from

Conversation

bryantAXS
Copy link

I added a json parameter to the get_list method, which creates two new tags {list_json} and {row_json} available between the get_list tag pair.

Each tag spits out a json representation of the list (or row) which can be used between script tags to quickly make data available to page scripts.

Example:

{exp:stash:get_list name="gallery_images" scope="site" context="site" json="yes"}

{if count == "1"}
<script>
var image_data = '{list_json}';
</script>
{/if}

{/exp:stash:get_list}

… tags {list_json} and {row_json} available between the get_list tag pair. Each tag spits out a json representation of the list (or row) which can be used between script tags to quickly make data available to page scripts
@croxton
Copy link
Owner

croxton commented Jul 23, 2012

I like the idea but I think this needs some more work.

get_list()and get() could support multiple formats such as jsonp and xml to enable full RESTful api capabilities.

@croxton
Copy link
Owner

croxton commented Aug 29, 2012

Now thinking this kind of thing might be better handled with a hook on the get_list method; make it easier for people to add their own output formats.

@croxton croxton closed this Apr 25, 2013
@timkelty
Copy link
Contributor

timkelty commented Mar 5, 2014

I'm in favor of a hook as well: #97

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants