Create your first page in Yii2 with customized url

Hi guys, in this tutorial you can see how to create a new page in Yii2 Framework. Yii is a free php framework that allows you to easily create your professional websites.

To create a new page, you must online create a new php file in your views folder. Then, open your controller, ad new action(the action will be used as url paramater for your new page). In new added action, write this cose:

return $this->render('newpage'); // newpage must be the name of your php created file.

In this way you can create your first page in Yii2.

In your PHP created file, you must add this code at the top:

<?php
$this->title = 'My new Page';
?>

This code will display the name of your created page.

Video tutorial:

In the following few days I will create new tutorials for Yii2 Framework!









Leave a Comment