title: Using Apache Server-side Flow Control in PHP?
body: <p>As discussed a bit in <a href="https://stackoverflow.com/questions/3592957/conditional-ssi-based-on-uri">this question</a>, I am using Apache <a href="http://httpd.apache.org/docs/2.2/mod/mod_include.html" rel="nofollow noreferrer">mod_include</a> with conditional flow control statements to alter the behavior of included shtml files depending on the URL of the parent page. The problem I'm having is that some of the pages on the site are PHP pages, which seems to mean that the mod_include directives are ignored (and instead treated as standard html comments).</p>
  
  <p>Is there any way to have PHP pages correctly process these mod_include directives?</p>
  
  <p>Specifically, here is what I am trying to have processed:</p>
  
  <pre><code>&lt;!--#if expr='"$DOCUMENT_NAME" = /(podcasts\.php)|(series\.php)/' --&gt;
  &lt;li id="features" class="current"&gt;
  &lt;!--#else --&gt;
  &lt;li id="features"&gt;
  &lt;!--#endif --&gt;
  </code></pre>
  
  <p>Similar lines blocks work in the .shtml files on the site, but for the php pages, all of the above ends up output to the client.</p>
  
  <p>Edit: The closest thing to a solution I have come up with is to mimic the functionality of the included shtml file in a php file. I don't like this solution because it means that adding links in the future will require adding them to multiple places.</p>