It looks like you're new here. If you want to get involved, click one of these buttons!
businessdad
MVP
I noticed that, with many pages in Vanilla, it's possible to simply add ".xml" or ".json" and have the page content returned in these formats (e.g. http://localhost/vanilla/categories.json). I'm trying to achieve the same with a plugin, but I'm having difficulties. As I expected, to request JSON or XML data it's not just a matter of adding a suffix. In my case, I create a Controller_MyPlugin() method, but I can't simply call http://localhost/vanilla/myplugin.json and get back Json data. So, first question is how do I "receive" these requests?
Once the JSON/XML request arrives, I guess I'll have to use a switch statement to choose what to render, but I'm not sure of this either, as "categories" controller doesn't do it.
Thanks in advance for the answers.
Awards/Badges Plugin now available! | My blog - About Me - My Plugins for Vanilla
Comments
wouldn't you just call the
http://vanillaforums.org/categories/questions/feed.xml
http://vanillaforums.org/categories/questions/feed.json
http://vanillaforums.org/categories/questions/feed.rss
based on an event and store and process results.
within the plugin and set up the plugin the usual way.
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •@peregrine I actually need to serve my own data, not the categories. Loading and returning the data is not the big deal, the issue is receiving the request for Json.
The issue I'm having now is the following: if call http://localhost/vanilla/myplugin/mycontroller, method Plugin_MyController is executed, as expected. If I just append .json (i.e. http://localhost/vanilla/myplugin/mycontroller.json), the request gets handled by the Index controller of the plugin, as if MyController were not found.
Awards/Badges Plugin now available! | My blog - About Me - My Plugins for Vanilla
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •here's to hoping x00 will come to the rescue. :). Looks like another interesting discussion.
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •Times like this i feel like im 3ft tall !
422 Real Estate Australia , now open Check it out
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •Sorry for the (possibly) stupid question: what does it mean? :)
Awards/Badges Plugin now available! | My blog - About Me - My Plugins for Vanilla
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •Means : the question is right over my head ;)
422 Real Estate Australia , now open Check it out
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •