How to include one .ctp file in another .ctp file in cakephp 3?

Hi,
How to include one .ctp file in another .ctp file in cakephp 3? Is it correct way ?

Not really, you should do it with Element (view) :wink:

But depend what you need to do exactly :innocent:

you can do it in two ways…

  1. create .ctp file in Elements directory under Template and include in another .ctp as
    $this->element('my_another_view')

  2. Extend view
    $this->extend(‘my_another_view’)
    This view need not to be in Elements directory