|
|
|
|
|
by akazantsev
16 days ago
|
|
> Now why do I have to care about "cloning templates" every time I render some html template? You do not have to. It's a self-sustained injury by the author. You can compile the templates once and just execute them. The issue is that author wants to specify page titles in the main templates. If you pass titles as a context, you can split base.tmpl into BASE_BEGIN, BASE_END and use them in the final templates. Yes, you will have to pass the title depending on the page template during the But his tactics will break anyway when you try to support different languages. |
|
There may also be a performance benefit too - I suspect that the Clone() operation is cheaper than re-parsing the base and any necessary partial templates in each render() call, but I've never benchmarked it, so I can't assert that with certainty.