0

When using this json addon in a template, it outputs just fine. However, when I try to call that template using embed into another template, it ends up as

'[]'

My setup is similar to this:

template/json
{exp:json:entries channel="resources"...}

template/main
{exp:channel:entries}
...stuff
{embed="template/json"}
{/exp:channel:entries}

Any ideas on what is going on?

3
  • Do you need to embed the entry ID or anything like that? – Laura Montgomery Jun 10 '16 at 10:14
  • I've tested with your example and it works fine for me, though I'm assuming it's just a typo in your code example where you have a : instead of a = in the embed tag? – James Smith Jun 10 '16 at 11:33
  • Typo was in my example, but my template code is fine. After a little bit more testing, it embeds and renders correctly in other templates, but not the one I need it to render on. Strange. – Chris Jun 10 '16 at 17:25
2

Found out through some more testing that it is a strange bug with how templates are being routed.

The json outputs fine on a page when seeing the rendered directly from the template.

However, when the page rendered through a page, this is when it fails.

Could not find a fix so far, but a workaround so far is to ajax in the json instead of directly embedding it on a page.

1

Probably need a dynamic="no" on your json tag.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.