Open evought opened 9 years ago
It ends up being possible to work around this now because parse_ini_file does substitute constants defined before the call. Therefore, one can define() a constant for a configuration directory in the end application and interpret it in the .ini. Not ideal, but it works and is being used in one of the unit tests to get around the fact that phing, phpunit, and Netbeans all launch the tests with different working directories. May therefore put this fix behind other issues in the queue.
At the moment, the default template is loaded relative to DIR and filenames for .ini files generally are not interpreted in any way. So, for instance, filenames for fallback templates embedded in .ini files are not very robust. There should be some way to configure or control the template directory or a search path for templates.
This issue may be best fixed by making TemplateRegistry a full class, allowing the user to configure the registry and, potentially, subclass it. I am imagining, particularly, that if one were using Template alongside vCardDB, one might want to store the templates for an application in the database and delay loading until a template is actually used. Allowing one to adapt the registry through polymorphism would make that more-or-less straight-forward and prevent me from trying to anticipate everyone's needs.