I know there’s document variables for longtitle, etc., but I swore there was one for grabbing the current URL...
-
MODX Staff
- 12,272 Posts
A relative URL can be written by doing the following: [~[*id*]~]
Full URL: [(site_url)][~[*id*]~]
Ryan Thrash, MODX Co-Founder
Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
Within a snippet or plugin you can create a URL for the current page using $modx->makeURL($modx->documentIdentifier)
Although you’d only really need to do that for the current page if you wanted to be sure that the URL you have is correct (according to your SEO or other rules) and it’s possible for it not to be (e.g., you’re not using the SEO Strict plugin), since otherwise you can just grab the URL from PHP’s built in vars ($_SERVER["REQUEST_URI"]).