You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: user_guide_src/source/tutorial/create_news_items.rst
+17-17Lines changed: 17 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,23 @@ You can read more about the CSRF protection in :doc:`Security <../libraries/secu
26
26
because :ref:`auto-routing-legacy` permits any HTTP method to access a controller.
27
27
Accessing the controller with a method you don't expect could bypass the filter.
28
28
29
+
Adding Routing Rules
30
+
********************
31
+
32
+
Before you can start adding news items into your CodeIgniter application
33
+
you have to add an extra rule to **app/Config/Routes.php** file. Make sure your
34
+
file contains the following:
35
+
36
+
.. literalinclude:: create_news_items/004.php
37
+
38
+
The route directive for ``'news/new'`` is placed before the directive for ``'news/(:segment)'`` to ensure that the form to create a news item is displayed.
39
+
40
+
The ``$routes->post()`` line defines the router for a POST request. It matches
41
+
only a POST request to the URI path **/news**, and it maps to the ``create()`` method of
42
+
the ``News`` class.
43
+
44
+
You can read more about different routing types in :ref:`defined-route-routing`.
45
+
29
46
Create a Form
30
47
*************
31
48
@@ -151,23 +168,6 @@ never need to do that, since it is an auto-incrementing field in the database.
151
168
This helps protect against Mass Assignment Vulnerabilities. If your model is
152
169
handling your timestamps, you would also leave those out.
153
170
154
-
Adding Routing Rules
155
-
********************
156
-
157
-
Before you can start adding news items into your CodeIgniter application
158
-
you have to add an extra rule to **app/Config/Routes.php** file. Make sure your
159
-
file contains the following:
160
-
161
-
.. literalinclude:: create_news_items/004.php
162
-
163
-
The route directive for ``'news/new'`` is placed before the directive for ``'news/(:segment)'`` to ensure that the form to create a news item is displayed.
164
-
165
-
The ``$routes->post()`` line defines the router for a POST request. It matches
166
-
only a POST request to the URI path **/news**, and it maps to the ``create()`` method of
167
-
the ``News`` class.
168
-
169
-
You can read more about different routing types in :ref:`defined-route-routing`.
0 commit comments