title: modx php get current page name
body: <p>In ModX, I'm trying to make a simple redirect based on which page the user is on. On my site, I have a chunk with various links to pages such as "About Us", "Careers", etc. This chuck is used on all pages on the site. </p>
  
  <p>My issue starts here - within the Careers page, there is a link to a new page which contains all available job postings. I would like to make it so that when the user is on the Careers page, clicking the link to the Careers page on the chunk will take them directly to the job posting page, rather than looping them right back to the Careers page.</p>
  
  <p>The url to the careers page is in this format:</p>
  
  <pre><code>www.example.com/index.php?q=careers.html
  </code></pre>
  
  <p>So, my code in the chunk for if the user is on the Careers page, redirect to job listings:</p>
  
  <pre><code>&lt;?php
      if ($_SERVER['PHP_SELF'] == "index.php?q=careers.html") {
        echo '&lt;p&gt;&lt;a href="www.joblistsite.com"&gt;Careers&lt;/a&gt;&lt;/p&gt;';
      } 
      else {
        echo '&lt;p&gt;&lt;a href="index.php?q=careers.html"&gt;Careers&lt;/a&gt;&lt;/p&gt;';
      }
  ?&gt;
  </code></pre>
  
  <p>But this doesn't work. It continues to link back to the Careers page instead of the job listings page. I've tried using the page's ID, but that doesn't either. What should I use for the <strong>if</strong> statement to get the current page in ModX? What am I doing wrong?</p>