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/outgoing/views.rst
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,6 +104,11 @@ example, you could load the **blog_view.php** file from **example/blog/Views** b
104
104
105
105
.. literalinclude:: views/005.php
106
106
107
+
.. note:: You must use backslashes (``\``) when referencing namespaced views,
108
+
as this is how CodeIgniter distinguishes a namespaced view from a regular
109
+
file path. Forward slashes (``/``) are only used for subdirectories within
110
+
the standard **app/Views** folder.
111
+
107
112
.. _views-overriding-namespaced-views:
108
113
109
114
Overriding Namespaced Views
@@ -151,6 +156,13 @@ To override this view (using the default configuration), create a file at the ma
151
156
152
157
Now, when you call ``view('Example\Blog\blog_view')``, CodeIgniter will automatically load your custom view from **app/Views/overrides/Example/Blog/blog_view.php** instead of the original module view file.
153
158
159
+
.. note:: The override path must match exactly how you reference the view.
160
+
If you load a view as ``view('Example\Blog\blog_view')``, the override
161
+
path is **app/Views/overrides/Example/Blog/blog_view.php**. However,
162
+
if you explicitly include the ``Views`` directory in the call, e.g.,
163
+
``view('Example\Blog\Views\blog_view')``, the override path must also
164
+
include it: **app/Views/overrides/Example/Blog/Views/blog_view.php**.
0 commit comments