Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP kohana framework template rendering issue - blank page

Tags:

php

kohana

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.

like image 696
Rahul Avatar asked May 30 '11 05:05

Rahul


1 Answers

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.

like image 85
The Pixel Developer Avatar answered Oct 16 '22 08:10

The Pixel Developer