-
Book Overview & Buying
-
Table Of Contents
Yii2 By Example
By :
Sometimes, views share the same common portion of content. In the examples made until now, we have seen that a common area for itemsList and itemDetail could be copyright data, which displays a disclaimer about copyright info.
In order to make this, we must put the common content in a separate view and call it using the renderPartial() method of controller (http://www.yiiframework.com/doc-2.0/yii-base-controller.html#renderPartial%28%29-detail). It has the same types of parameters of the render() method; the main difference between the render() and renderPartial() methods is that render() writes a view content in layout and renderPartial() writes only view contents to output.
In this example, we create a common view for both itemsList and itemDetail about copyright data.
Create a view file named _copyright.php in views/news.
Usually, in Yii2's app, a view name that starts with underscore stands for common...
Change the font size
Change margin width
Change background colour