Vista
Includes
You can use includes within any view relative to the root views folder.
In this example, the layout file:
The include('sidebar', ['menu' => ['Home', 'About', 'Contact']])
method passes a menu variable to the sidebar.php
view.
Inside sidebar.php
, the $menu
array will be accessible.
Advanced Include Features
Expanding the project to include a users’ folder.
Relative Include
To include a view relative to the current view file prefix the include value with :
:
Conditional Include
You can also include with includeIf()
which will only include the view if conditionals are meet:
File Include
You can include a specific file using its absolute path: