I’m using both versions of your code. Both of which return a blank output. I think the "unauthorized access" message is because of a caching issue, which I turned off for the test page I am using.
Is there any other way to debug what might be going on? Does MODx log output anywhere?
Well, there’s the "Event log viewer" under the Administration tab and the Audit trail. Are you calling the snippet cached or unchached ([[getDoc]] or [!getDoc!]). I need learn more about the differences between the two, but I’ve always been told to use [! !] which does not cache.
Sorry I couldn’t be more helpful.
Well, I’ve sort of figured it out. It seems for me the getdoc function works correctly if the page does not use a tempate that has template variables. If i try to get a page the is based on a template that has template variables, it spits out a blank page.
Oh well, back to the drawing board. Thanks again for your help!
Well, you found a pattern, but I don’t think that’s the problem. All template variables are associated with templates. So in order to use the getDoc to grab a template variable, by definition the page you are looking for has to have a template (with template variables).
I’d look again at your template variables and the document security you have set for them. That would explain the access error you got.
First of all awesome snippet.
Second: Im thinking of having the id as a template variable so the client could choose an id to show themselves without them going near the snippet call and having to edit the code.
Thanks,