brunnofoggia / chillrender
1.0.0
2017-01-23 21:21 UTC
Requires
- php: >=5.4.0
- brunnofoggia/darktrait: 1.*
This package is not auto-updated.
Last update: 2024-09-23 13:52:28 UTC
README
快速且轻松渲染视图的实用工具
用法
将其实现到您的类中
class Test { use \ChillRender; }设置您的路径
protected $attrDefaults = [ 'layout' => 'views/layout', // file extension is .php by default, but you can send yours 'viewPath' => 'views/' ];渲染
// Just rendering $this->render('index'); // Sending data to view $this->render('views/index', ['mydata' => $data]); // Rendering with other layout $this->render('views/index', [], 'views/other_layout'); // Rendering without layout $this->render('views/index', [], false); // Rendering layout with custom content $this->renderLayout(['content' => $custom]); // Rendering a partial view $this->renderPartial('views/sidebar', ['mydata' => $data]);
- 对于Ajax请求,布局将不会渲染