We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 509
    • 93 Posts
    Hello,

    Quick question I think but I am not sure if there is a way to retreive a value from a specific attribute when we know the doc id.

    Exemple
    In my template I use for example [~43~] to create a link to the document with the id 43.
    I would like also to retreive the title of this document. Is there a syntax to do this without coding a snippet?

    Thanks in advance smiley
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      No. In creating a link URL MODx simply uses the resource ID supplied to generate the URL; it keeps a list of IDs and aliases in an array that it loads from the site cache on every page request. But to access these or any other values from resources other than the one being processed you need to use some PHP. There are some easy-to-use snippets, such as the GetField snippet.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 509
        • 93 Posts
        Thank you sottwell with your very clear explainations.
        I will retreive GetField snippet.

        May I suggest that this snippet could a default one ?