I know from the docs that, actually, directory listing templates are based on XSSI.
Therefore you can check for the APPL_MD_PATH environment variable in a XSSI
if statement for checking the $APPL_MD_PATH variable in some
if expr= XSSI line.
The docs say that the directory template system uses XSSI and that it has additional environment variables, in addition to them, all variables of CGI / FastCGI are also available for template use.
Therefore in the meantime, before a new version of Abyss Web Server is released with the mentioned suggestion, you can do this:
In the directory template section, add
if expr= checks against APPL_MD_PATH (folder path being listed).
Add as many if blocks as needed using if, elif (else if) & else statements.
For each if, for each one when it matches, use the XSSI include file statement to include the actual template content that you want for a specific directory.
Example:
Write your HTML template in many versions (here header files):
take note of the .shtml extension
header-default.shtml
header-light.shtml
header-dark.shtml
...
In the header field of Abyss X1 / X2 hostnames: (expr checks use the RegEx format)
<!-- #if expr="’$APPL_MD_PATH’ = /^\/folder\-dark(?:\/|)$/" -->
<!-- #include virtual="/templates/header-dark.shtml" encoding="none" -->
<!-- #elif expr="’$APPL_MD_PATH’ = /^\/folder\-light(?:\/|)$/" -->
<!-- #include virtual="/templates/header-light.shtml" encoding="none" -->
<!-- #else -->
<!-- #include virtual="/templates/header-default.shtml" encoding="none" -->
<!-- #endif -->
This should 'trick' the template system into using different templates depending on the directory being listed.
#include virtual= stands for including a file from a relative server directory.
It's not really a trick, but rather some uncommon way of using directory templates, which nonetheless does the job.
It will work as long as you enable XSSI processing for your hostname in Abyss Web Server and leave the shtml extension as allowed for XSSI.
Edit: it should work for .php [and other] files so you can actually use XSSI as a conditional check that runs the correct directory listing's php, etc script.
Just make sure that your php scripts for directory listing cannot be run by outsiders othan than 127.0.0.1 & ::1 IP addresses.
Depending on how you write them, you might or might not accidentally allow listing protected server directories otherwise.
Use IP Address Control for this, for the listing php & such scripts.