I'm wanting to create a static resource of a PHP type so that I can reference it as a URL. I'm using it as the data source for an autocomplete text field. From what I've read this is possible, but I'm having issues.
I've got a PHP content type setup and have tried several mime types (text/html, text/php, etc). How do I make this work?
-
MODX Staff
- 1,535 Posts
Create a snippet that handles the PHP processing and place that in your resource content. Make sure you call the snippet uncached as it sounds like your processing will rely on POST and/or GET parameters.
You don't really need the PHP content type, you can keep it as HTML and just delegate all the PHP necessities to the snippet.
Garry Nutting
Senior Developer
MODX, LLC
Email:
[email protected]
Twitter: @garryn
Web: modx.com
OK, that's what I'm already doing, but it looked like the static resource would let me do that as well.
No, static resource content is to be parsed by MODx. It can not be executed.
-
☆ A M B ☆
- 24,524 Posts
Indeed. A static resource is only a resource whose content is stored in a file instead of the database; otherwise it is exactly like any other resource.