htmlif-statementssi

SSI - test if a file exists


I'm dynamically adding ssi includes based on variables and I would like to be able to have a default include in case a file doesn't exist. ie:

if /file/testthisfile.ssi exists
    add /file/testthisfile.ssi
else
    add /file/default.ssi

Is this possible?

Thanks!


Solution

  • No - I was afraid of that answer. But for anyone who might come across this question in the future I did find a work around for simple cases. You can edit the error message and in my case, output an image:

    <!--#config errmsg="<img src='/file/testthisfile.jpg' alt='' />" -->
    

    So if the file doesn't exist you can set a default.

    Must underline that this will only work for simple cases, but it's a nice little work around!