added templating features (php still pending)