We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23491 ☆ A M B ☆
    • 1,056 Posts
    Let’s say I have a defined document, doc_id 999 titled: My Document’s Title.

    In an earlier document, doc_id 100, I want to link to doc_id 999, using its title for both title attribute as well as the hyperlink text.

    Is there anyway to dynamically pull the title (amongst other TVs) from a given doc_id?

    Example:

    <a href="[~999~]" title="[*pagetitle:999*]">[*longtitle:999*]</a>
     


    Can this be done using Ditto? Does this functionality require Ditto, or is there a method native to MODx that can assist with this seemingly easy task?
      Mike Reid - www.pixelchutes.com
      MODx Ambassador / Contributor
      [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
      ________________________________
      Where every pixel matters.
      • 18397
      • 3,250 Posts
      You should use the getDoc (or was it getField?) snippet.
        • 23491 ☆ A M B ☆
        • 1,056 Posts
        Ah, gracias! It appears the getdoc idea was yours laugh ? ...and the offspring-variant was getField, which introduced hierarchy. I like the simplicity to your approach, and this will be perfect. Maybe I should take getField and create a new super mutant snippet huh
          Mike Reid - www.pixelchutes.com
          MODx Ambassador / Contributor
          [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
          ________________________________
          Where every pixel matters.
          • 7923
          • 4,213 Posts
          I think that the main difference in getDoc and getField is that the latter knows how to get TV’s also.. so if (you need to retrieve TV’s) { use getField } else { use getDoc }


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."