Can some tell me if I'm wrong, but it doesn't look like I can create a variable to store a query result into it where I leveraged EE's native {exp:query} functionality?

I want to use PHP native json_encode functionality to output the contents of a complex query(some of the data I'm querying cannot be displayed using the Channel entries tag) to JSON. So either I have to create a pure PHP file outside of EE or "allow php" in my EE template.


Create a plugin - don't do this in the template. Then you can do whatever you like in pure PHP (with access to all of EE's helper functions, libraries, etc), create a variables array, and then return it for use as template tags.


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.