Any way for a server-side include to get the file name or URL of the file where it is being included

Posted by mikez302 on Stack Overflow See other posts from Stack Overflow or by mikez302
Published on 2010-06-09T17:55:25Z Indexed on 2010/06/09 18:22 UTC
Read the original article Hit count: 263

Filed under:
|
|

Is there any way for a server-side include to determine what file it is being included in? I would like to do something like this:

<ul id="menu">
    <!--#if expr="$URL = index.html" -->
        <li><span>Home</span></li>
    <!--#else -->
        <li><a href="index.html">Home</a></li>
    <!--#endif -->
    <!--#if expr="$URL = about.html" -->
        <li><span>About us</span></li>
    <!--#else -->
        <li><a href="about.html">About us</a></li>
    <!--#endif -->
    <!--#if expr="$URL = contact.html" -->
        <li><span>Contact us</span></li>
    <!--#else -->
        <li><a href="contact.html">Contact us</a></li>
    <!--#endif -->
</ul>

I just need to know if it is possible using server-side includes, and if so, what the syntax would be.

© Stack Overflow or respective owner

Related posts about apache

Related posts about server-side-includes