Closed nanodocumet closed 13 years ago
Pretty sure this is a duplicate of #19.
You are totally correct.
It is a duplicate, however, the patch just partially solved the issue. The first if just checks for $template, it should be for $this->_template (line 61). My patch is to redo that sequence of if and else statements with the code above (lines 61 - 73).
Sorry, was late at night and forgot to mention #19 (even though I looked at it). I should of added a comment to the other issue instead of creating a new one, sorry.
I'm actually not sure this behavior would preferred... what if you want to overload the template that is defined in the view? Your patch would make it impossible to overload.
How are you thinking of overloading the template defined in the view? Right now using the New View constructor and the factory() load different templates if $this->_template is defined (take a look of my example in original issue). So, which one should take precedence?
1) The name of the view to load an equivalent template? or 2) A defined $this->_template?
Either way, I think constructor and factory should return the same template.
For example, in Controller_Template, $template = 'template' by default, if I extend Controller_Template and don't overwrite $template, it doesn't mean the the new Controller name will be used for the template. Controller_Website extends Controller_Template does not use $this->template set to Website unless I specify explicitly. Same here I guess.
Am I missing something? thanks.
I think I see what you mean now, and I think the correct solution is to patch Kostache::factory. This would ensure that the template is always detected by Kostache::__construct
, not before.
Yes. thanks.
Do not include the template name in Kostache::factory, do all template detection in __construct, closed by d2eadd380c0c72e1c2dc3135b4de6c7fbe3124ad
Not sure if this is a bug or desired behavior. Example
View:
When using (@ controller)
Either __construct should check if $this->_template is set like this
Or that check can be done at the factory, I think the __construct way looks cleaner.