Re: [PHPTAL] Template name hashes

2012-08-15 Thread Kornel Lesi��ski
I think copy&paste of whole getFunctionName is fine. I'm not sure whether it's responsibility of sources to compute the hash. You could however create and set your own template repository class that returns sources that use fake paths. Compile ahead of time is a good use-case. That's somethi

Re: [PHPTAL] Template name hashes

2012-08-15 Thread Robert Goldsmith
We actually have 5 template directories so it is easiest to keep the cache dir separate. It also keeps the live environment similar to the dev environment so easier for debugging etc. However, even just subclassing getFunctionName is a problem because we actually need to change a couple of line

Re: [PHPTAL] Template name hashes

2012-08-15 Thread Kornel Lesi��ski
I don't understand why do you need to patch anything else other than getFunctionName and cleanUpGarbage. Change those two and configure temp dir to be your template dir. Unless you want temp dir for phptal:cache separate from template dir? -- regards, Kornel On 15 sie 2012, at 15:56, Robert

Re: [PHPTAL] Template name hashes

2012-08-15 Thread Robert Goldsmith
The private methods used in the PHPTAL class effectively prevent subclassing to extend / replace the hashing. I can see your argument because the PHPTAL class is still very 'generic' and large despite all the work to have support classes and subclassing it could cause problems in future releases

Re: [PHPTAL] Template name hashes

2012-08-15 Thread Kornel Lesi��ski
The fact there are protected methods is historical. There can be interactions between base class and subclasses via overridden protected methods, so protected methods are de-facto a public interface. Subclassing may cause Fragile Base Class Problem (the non-C++ kind), so I prefer to mark all

Re: [PHPTAL] Template name hashes

2012-08-15 Thread Robert Goldsmith
Hello :) Thanks for those pointers :D I'm also going to override prepare() to throw an exception if the template needs parsing because this won't be allowed on a live system. One thing I have noticed, however, is that 4 functions in the PHPTAL class are private rather than protected: g

Re: [PHPTAL] Template name hashes

2012-08-15 Thread Kornel Lesi��ski
The hash is computed in PHPTAL::getFunctionName(). Filename is built from that name. Subclass PHPTAL class and override this method to compute unique name from path/settings you care about. Also override cleanUpGarbage() to stop it from deleting compiled templates. -- regards, Kornel On

[PHPTAL] Template name hashes

2012-08-15 Thread Robert Goldsmith
Hi all, We're implementing a deployment system using phars and pre-compiled templates from phptal and things are mostly going well but we've noticed that the template file hashes appear to be based on the full path of the template when it is initially compiled. Obviously if we then move the tem