in reply to •Re: testing for the existence of a tt template: better way?
in thread testing for the existence of a tt template: better way?

Thank you. That is much neater, but it's not quite the same thing: It tests that the template exists *and works*. Which would be useful in a public-facing system, but a bit of a drawback in development, where it would obscure (and worse, silence) an error of any kind that happened behind the TRY statement.

I'd also be mildly concerned about using an error mechanism to handle an expected event: apart from the minor misapplication, I would guess that it's a lot more economical to call -e -f a few times than to go through the whole Template exception-handling mechanism and then discard its output. A minor difference, probably, but if the try and catch was in a list-display loop I could easily be causing and intercepting twenty or fifty deaths per page...

So I guess I am going to have to stumble around inside the template parser and attempt to extend its syntax. I'm sure it will be very good for me.

update Actually, maybe all that's needed is a configuration option that if set, causes the compiler to return false rather than raising an exception when a template file can't be found. It should be easier than going into the parser, anyway. Shudder.

  • Comment on Re: •Re: testing for the existence of a tt template: better way?