Improved templating system

Added a superclass BasePageHandler, that offers a method to print a
template.
Now all handler extend this class and just need to call the
write_template method specifying template name and optionals template
values