We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18666
    • 8 Posts
    As per subject.

    I want to get hold of another document’s introtext and to navigate there, I’d use it’s id. However, I can’t find any function in the API Quick Reference (Which sadly is the only source of reference for me and it’s a little sparse) that will do this job...

    I know I can get the current doc’s stuff. What about getting another doc’s stuff via it’s id? Is that possible?

    Thanks
    • See the function getDocument($id=0,$fields="*",$published=1, $deleted=0) in /manager/includes/document.parser.class.inc.php, which for some stupid reason, is not in the API documentation. Doh! I’ll see about getting someone to add this ASAP.
        • 18666
        • 8 Posts
        Thanks! That is just what I needed.

        And yes, we need a proper and up to date API reference...
          • 27226
          • 186 Posts
          Strangely enough I never was aware of this distinction!
          No one ever told me that I could access a doc’s content without an Id!
          For me there was always one and the same starting point:
          $cid = $modx->documentIdentifier; //current document

          For the rest I always used "$cid" as a param - as indicated in the documentation.
          Seems I’ve made it more difficult than necessary??
          • Quote from: silent at Aug 18, 2006, 06:55 PM

            Strangely enough I never was aware of this distinction!
            No one ever told me that I could access a doc’s content without an Id!
            For me there was always one and the same starting point:
            $cid = $modx->documentIdentifier; //current document

            For the rest I always used "$cid" as a param - as indicated in the documentation.
            Seems I’ve made it more difficult than necessary??
            I’m not following what distinction you mean. $modx->getDocument($id) gets a specific documents fields, while the $modx->documentIdentifier is the current document ID, and $modx->documentObject holds the current documents attributes + TV values. $modx->getDocument($id) does not retrieve TV’s that are part of the document or anything but the fields you specify from that document’s site_content table row.
              • 27226
              • 186 Posts
              The distinction in question is knowing where you are or not knowing it (i.e. needing a doc id to access something).
              But - as always - I understand your explanation and that my confusion could have be avoided.
              Not by the documentation - but by me myself & I.
              Sorry!
                • 33372
                • 1,611 Posts
                You know I only recently figured out the getDocument function as well... I knew there had to be such a thing, and I had searched and searched in the documentation for it. Finally I went through the parser code and found it in there (and life was sweet again).
                  "Things are not what they appear to be; nor are they otherwise." - Buddha

                  "Well, gee, Buddha - that wasn't very helpful..." - ZAP

                  Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options