klein / klein.php

A fast & flexible router
MIT License
2.66k stars 290 forks source link

View override #296

Open andrewtheone opened 9 years ago

andrewtheone commented 9 years ago

hey, i was looking through you code, but couldnt find where you include the view files or whats so ever.

My app would store all templates in database, and in dev-mode it would download them parse and store them by slug names in views folder, it can be done without modifying your view handler, but I wanted to take a look at it but cannot find anything like require, include or whatsoever.

Where to look?

eimajenthat commented 9 years ago

It's in the ServiceProvider class. The main function is ServiceProvider::render(): https://github.com/chriso/klein.php/blob/master/src/Klein/ServiceProvider.php#L313

But there's a layout function, and yieldView, and a few others nearby that can be used for view rendering as well.

Why are you storing the templates in the database? I'm sure you have your reasons, just curious.