Forum Moderators: phranque

Message Too Old, No Replies

PHP in HeaderName or ReadmeName?

Dynamic header and footer for directory listings

         

akbigdog

7:08 am on Feb 26, 2005 (gmt 0)

10+ Year Member



I currently have a VirtualHost set up and have the default HeaderName and ReadmeName to index_header.shtml and index_footer.shtml, respectively. But I would like to use PHP instead. Is there a way to do this? Here is the VirtualHost code I have:

<VirtualHost *:80> 
DocumentRoot W:\path\to\document\root
ServerName nameofmy.site
IndexOptions +IgnoreCase +SuppressDescription NameWidth=* +SuppressHTMLPreamble
<Directory "/">
HeaderName index_header.shtml
ReadmeName index_footer.shtml
</Directory>
</VirtualHost>

If it is not possible to use PHP, is there a way to set the entire "/" directory tree to use the same two files? Or do I have to place index_header.shtml and index_footer.shtml in every directory that I want to use them?

Server configuration:
Windows XP Pro SP2 running Apache/2.0.52 (Win32) mod_ssl/2.0.52 OpenSSL/0.9.7e PHP/5.0.3 Server

akbigdog

10:07 am on Mar 12, 2005 (gmt 0)

10+ Year Member



Well, by the number of responses I got on this post, should I assume that this cannot be done?

coopster

11:04 am on Mar 12, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, akbigdog.

Yes, it is possible, but not without some extra steps.


Filename must resolve to a document with a major content type of text/* (e.g., text/html, text/plain, etc.). This means that filename may refer to a CGI script if the script's actual file type (as opposed to its output) is marked as text/html such as with a directive like:

AddType text/html .cgi

Content negotiation will be performed if Options MultiViews is in effect. If filename resolves to a static text/html document (not a CGI script) and either one of the options Includes or IncludesNOEXEC is enabled, the file will be processed for server-side includes (see the mod_include documentation).

[httpd.apache.org...]