CakePHP View including other views

2020-06-01 10:33发布

I have a CakePHP application that in some moment will show a view with product media (pictures or videos) I want to know if, there is someway to include another view that threats the video or threats the pictures, depending on a flag. I want to use those "small views" to several other purposes, so It should be "like" a cake component, for reutilization.

What you guys suggest to use to be in Cake conventions (and not using a raw include('') command)

7条回答
小情绪 Triste *
2楼-- · 2020-06-01 11:15

In CakePHP 3.x you can simple use:

$this->render('view')

This will render the view from the same directory as parent view.

查看更多
登录 后发表回答