Here's a fun one ;-)
I'm working on a plugin that triggers on the OnPageNotFound event, checks if the URL contains "json" or "xml" as a file extension, and then attempts to return the page's content in that format (basically, an ad-hoc API).
However, the tricky part of that is determining what page the user is looking for in the first place. I'd like to do this by first determining the resource's ID, which would then allow me to do pretty much whatever I want with its content. However, as you'd expect, OnPageNotFound doesn't have access to the resource object (according to
http://rtfm.modx.com/display/revolution20/OnPageNotFound). I also have paths turned on, which means I can't just grab the alias; I need to basically traverse the entire URI.
Has anyone attempted this? I think I can figure it out, but if someone's already done it and has sample code, it would be appreciated. Thanks!
[ed. note: aladage last edited this post 14 years, 2 months ago.]