O'Reilly logo

CouchDB and PHP Web Development Beginner's Guide by Tim Juravich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — rendering views inside of our routes

Let's replace the existing portions of code inside our routes that just echoed out text with the following code that will actually use our new framework:

get('/', function($app) {
$app->set('message', 'Welcome Back!');
$app->render('home');

});
get('/signup', function($app) {
$app->render('signup');

});

What just happened?

For the root route, we used our new function set to pass a variable with the key of'message' and its contents being'Welcome Back!', and we then told Bones to render the home view. For the signup route, we are just rendering the signup view.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required