0

I'm new to PHP Laravel framework. I'm studying it and playing with simple examples of code. My problem is that my views do not output anything - a blank white screen appears when I try to reach controller methods, for example, localhost/my-application/cms/action1

My routes file:

Route::controller('cms', 'CmsController');

My controller:

class CmsController extends BaseController {

public function getIndex()
{
    View::make('cms.index');
}

public function getAction1()
{
    View::make('cms.action1');
}

public function getAction2()
{
    View::make('cms.action2');
}

}

My views are located in views/cms. They are very simple, for example:

<h1>Action1</h1>
<?php echo 'this is Action1'; ?>

And these views do not output anything, just simple blank white page appears. I tried to:

1) rename views files, and Laravel threw exception - "view not found", or so.

2) move view::make() methods to Routes file - the views were displayed then.

So where is the problem?

1 Answer 1

2

The bootstrap index.php file in laravel is inside the public folder.

So unless you've created a vhost for your application, you have to access it like

localhost/my-application/public/cms/action1

EDIT

Forget it. The problem is that you do not return the view::make from each function.

return View::make('cms.index');
Sign up to request clarification or add additional context in comments.

1 Comment

Sorry, we are talking about different problems. I can step into my getAction1() method with debugger. I even can echo something in that method. But the views do not output anything.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.