CakePHP: How to use a view element inside of a controller

后端 未结 6 1142
情深已故
情深已故 2020-12-17 20:52

I\'m trying to figure out how to use one of my view elements inside of a controller...

I know, I know: \"Don\'t do that!\" (99% of the time this is

6条回答
  •  时光取名叫无心
    2020-12-17 21:36

    Easy:

    $view = new View($this, false);
    $content = $view->element('my-element', $params);
    

    Also:

    DON'T DO THAT ANYMORE!!!

提交回复
热议问题