On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • This is most likely a stupid question, but I didn’t find an answer in the docs.
    (And if it’s a stupid question it should be easy to get an answer rolleyes)
    In php and template code I frequently find the tilde character (~), often in conjunction with "[", for instance [tt]"[~$id~]"[/tt] being magically transformed to index.php?id=##. Or used in a template like [tt]a href="[~[(site_start)]~]"[/tt]
    Can someone explain me how that works??

    Thanks in advance.
    • ppaul, the [~ ~] tags are for generating links from the ID of a MODx document. So [~1~] would be replaced with the appropriate link to document with ID = 1; other tags can then be nested, so [(site_start)] is a system setting tag that can be used to create a link to the site_start page, since it returns the document ID of that page, hence [~[(site_start)]~]

      Might also check out the AliasLinks plugin for additional ways to build links via a document alias.
      • Ahh! and it resolves expressions/variables etc which return an id between the ~~ making it easy to create a link.
        Good to know.
        Thanks Jason for your patience!