We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 585
    • 24 Posts
    How to find the first document with a particular alias in a plugin?
      • 585
      • 24 Posts
      No replieds because my question is not specific enough?

      I would think - based on my limited knowledge of the modx objects and methods - that it is possible to move the document tree into an array
      with info on each doc in the the columns of the array and then sequence through the array.

      Maybe that should be the question? How to move the document tree into an array?

      thanks
        • 10449
        • 956 Posts
        a) find an alias in a snippet?
        b) find an alias in the manager?
        c) find an alias via search on frontend pages? (e.g. Ajax Search)

        You’re not very specific.

        For b) you could change the manager’s in-built search: add a "search by alias" field and modify the query.
        = Tab "site" -> "search"
        /manager/index.php?a=71

        In any case, look at the the database tables if you want to write your own query. Shouldn’t be hard to find (probably a field inside table modx_site_content).
          • 585
          • 24 Posts
          I see -
          I need to find a document with an alias in a plugin.

          I created a plugin that checks for keywords before showing the content.
          It uses case statements to check for the words and then puts in links to other docs on the site for those related words.

          However, I would like to find the first doc with the alias of the keyword and not hard code the link address.

          Make sense?

          thanks for the reply - I hope this helps.