@@ -19,7 +19,7 @@ Using the example controller you created in the controller page, let’s add a v
19
19
Creating a View
20
20
===============
21
21
22
- Using your text editor, create a file called ``blogview .php `` and put this in it::
22
+ Using your text editor, create a file called ``blog_view .php `` and put this in it::
23
23
24
24
<html>
25
25
<head>
@@ -53,7 +53,7 @@ Now, open the controller file you made earlier called ``Blog.php``, and replace
53
53
{
54
54
public function index()
55
55
{
56
- echo view('blogview ');
56
+ echo view('blog_view ');
57
57
}
58
58
}
59
59
@@ -109,9 +109,9 @@ to package your views together in a module-like fashion for easy re-use or distr
109
109
110
110
If you have ``Blog `` directory that has a PSR-4 mapping set up in the :doc: `Autoloader </concepts/autoloader >` living
111
111
under the namespace ``Example\Blog ``, you could retrieve view files as if they were namespaced also. Following this
112
- example, you could load the **blogview .php ** file from **Blog/Views ** by prepending the namespace to the view name::
112
+ example, you could load the **blog_view .php ** file from **Blog/Views ** by prepending the namespace to the view name::
113
113
114
- echo view('Example\Blog\Views\blogview ');
114
+ echo view('Example\Blog\Views\blog_view ');
115
115
116
116
Caching Views
117
117
=============
@@ -140,7 +140,7 @@ Here's an example::
140
140
'message' => 'My Message',
141
141
];
142
142
143
- echo view('blogview ', $data);
143
+ echo view('blog_view ', $data);
144
144
145
145
Let's try it with your controller file. Open it and add this code::
146
146
@@ -155,7 +155,7 @@ Let's try it with your controller file. Open it and add this code::
155
155
$data['title'] = "My Real Title";
156
156
$data['heading'] = "My Real Heading";
157
157
158
- echo view('blogview ', $data);
158
+ echo view('blog_view ', $data);
159
159
}
160
160
}
161
161
@@ -184,7 +184,7 @@ into the `$option` array in the third parameter.
184
184
'message' => 'My Message',
185
185
];
186
186
187
- echo view('blogview ', $data, ['saveData' => true]);
187
+ echo view('blog_view ', $data, ['saveData' => true]);
188
188
189
189
Additionally, if you would like the default functionality of the view function to be that it does save the data
190
190
between calls, you can set ``$saveData `` to **true ** in **app/Config/Views.php **.
@@ -212,7 +212,7 @@ Here’s a simple example. Add this to your controller::
212
212
'heading' => 'My Real Heading',
213
213
];
214
214
215
- echo view('blogview ', $data);
215
+ echo view('blog_view ', $data);
216
216
}
217
217
}
218
218
0 commit comments