rsanchez / json

Output ExpressionEngine data in JSON format.
http://devot-ee.com/add-ons/json/
101 stars 234 forks source link

show_categories not working #33

Closed aelvan closed 10 years ago

aelvan commented 10 years ago

Adding show_categories="yes" to my exp:json:entries tag didn't work. I dug into the code and found out that this conditional around line 235 never was true:

if (ee()->TMPL->fetch_param('show_categories') === 'yes')

It works in the fist case, around line 190, but after that it's just empty. I solved this by storing the value of the fetch_param in a variable and using that in the conditionals instead.

Using EE 2.7.3 and JSON 1.1.2.

rsanchez commented 10 years ago

Want to make a pull request? :) Seems like the fix is something like:

$show_categories = ee()->TMPL->fetch_param('show_categories') === 'yes';

And then simply use if ($show_categories) in subsequent conditionals. I'm not sure why it would evaluate as empty in the first place, but it seems easily solvable.

aelvan commented 10 years ago

Wish I knew how to do that, I'm a git noob. ;)

And yeah, that fix is exactly what I did.

rsanchez commented 10 years ago

No worries. Thanks for the bug report and the clear solution. This will be fixed in the next release.