6

I have created one function to fetch the user inbox message and display it using "user-profile-messages" templates. Also I have added functionality (in the same function) to deleting bulk inbox message if user clicked on delete all button. But after deleting all messages, page/template is not redering. Please let me know what could be the reason.

I am rendering page using below method.

 $this->template->body = View::factory("user-profile-messages", array(
            "msg" => $msg,
            "messages" => $messages,
        ))->render();

I am using Kohana latest version.

Shakti Singh
  • 84,385
  • 21
  • 134
  • 153
Rahul
  • 2,511
  • 3
  • 20
  • 20

1 Answers1

2

First of all, if you're not extending the template controller, then your code should be:

$view = View::factory("user-profile-messages", array(
    "msg" => $msg,
    "messages" => $messages,
));

$this->response->body($view)

Output is set by $this->response->body($view). Calling render isn't needed as it has a __toString method.


If you're extending the template controller, which it looks like you are. It renders output automatically unless you explicity tell it not to:

$this->auto_render = FALSE;

By default, it's going to render the template template with a variable body which will contain your view.

The Pixel Developer
  • 13,282
  • 10
  • 43
  • 60