Is there an API or function within MODX to generate an array or a simple list of id numbers for published resources? The resultant array would be used in an external PHP scipt.
If there is no existing way to do such, would someone be able to direct me to the appropriate table and columns within the extensive MODX database where this data is stored?
[ed. note: mrcycling last edited this post 11 years ago.]
Thanks. I actually will be using the array/list outside of MODX (I modified my question a bit to clarify this).
I am fetching completed webpages with the PHP script, then preforming some magic on them, before storing them elsewhere. Currently using a handbuilt array, but would like to automate that part.
You can do it with PDO, but it's usually easier just to instantiate MODX and use the code above.
http://bobsguides.com/blog.html/2013/07/13/using-modx-outside-of-modx/
discuss.answer
Thanks for all the suggestions.
I ended up going with PDO / PHP totally outside of MODX. Once I figured out the resource IDs and Published status are stored in modx_site_content and the TV values for each resource are stored in modx_site_tmplvar_contentvalues, it was fairly straight forward to construct queries to fetch the data straight from the source.
This was the final "nice to have" aspect in our quest to turn MODX into a backend static page generator instead of a front active page server.
[ed. note: mrcycling last edited this post 11 years ago.]
Keep in mind that TVs set to the TV's default value are *not* stored in the contentvalues table. A missing record there means you have to check the TV object's default_text value.
If no TVs have the default value and none use @ bindings, a lot of complexity goes away and things run much faster (especially if you can use the raw values of the TVs).
You might also find this helpful:
http://bobsguides.com/blog.html/2014/09/29/using-getvalue%28%29-with-tvs/
@BobRay - Thanks. Fortunately, the TV that I am using has no default or an @ binding, as each one has to be unique for that resource since it will be their url ;-).