Smarty improvements

Various Smarty extension improvements to fix #4553.

**TODO**:

- [x] unit test template inheritance
- [x] update docs to reflect all changes.
- [x] update changelog to reflect all changes.