We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Render Partial in Controller

Hi. sorry my english is not so good. I have a problem when using partial view. i need only html string in my partial file not all html tag (include header and footer). when i use partial in controller, it send whole html tag string. this is my controller code

<?php
class CourseController extends ControllerBase {
    public function indexAction(){
    $view = new View\Simple();
        $view->setViewsDir(__DIR__."/../views/");
        echo $view->partial('course/partial/_list_course',[
            'courseList' => $courseList
        ]);
    }
}

this is my example partial view

<div>test</div>

how to get only string <div>test</div>? not all html tag (include header and footer).



844
Accepted
answer

ahh...... sorry for my stupid question. i only add $this->view->disable(); and works perfectly..