Plugin

Developer
Supported

URL Tube

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Mark Spurlock

     

You must be logged in to post.

URL Tube and JSON not working

General

Gene Rocha
Gene Rocha

Hello,

I am able to use URL Tube without any issues expect when I would like to output the data in a JSON file.

I am using the JSON encode plugin.

The below code output nothing.

“foo” : “{exp:url_tube src=’{gallery_files:video}’}”

Please let me know how I can output the data in a JSON format.

Spurlock
# 1
Developer
Spurlock

Hi Gene,

URL Tube is built to generate HTML, so I’m not too surprised that it doesn’t plug seamlessly into JSON. I haven’t used the JSON Encode plugin before, but it looks straightforward enough that I can probably guess about it.

So, my first guess is that the quotes used in the HTML output aren’t being escaped. You’ve said that you’re using the JSON Encode plugin, but I notice that there are no tags for it in the code you posted below. I would expect it to look more like this:

“foo” “{exp:json_encode}{exp:url_tube src=’{gallery_files:video}’}{/exp:json_encode}” 

If you’re instead wrapping that entire code block in JSON Encode tags, then that’s probably not what you want to do, and might explain the issue.

When you say that the code below outputs nothing, do you mean literally? If the word “foo” isn’t even coming out, then your problem can’t be URL Tube. If it isn’t literally nothing, can you post the output? And the output after adding the JSON Encode tags above?

Also, have you tried turning template debugging on and seeing whether there are any errors in there, relating to URL Tube, JSON Encode, or perhaps even your {gallery_files:video} tag?