Get to know the heart and soul of Nova - controllers
/main/contact
In the above example, the main
controller will be loaded and the contact
method will be called.
/characters/bio/77
In this example, the characters
controller will be loaded and the bio
method will be called. Additionally, you’ll be able to add an argument to your controller method to access the 77
in the URI. (This is what allows Nova to have access to the necessary data to show a specific character bio without having to hard-code everything.)
nova
directory. (As an aside, this is what allows for the simplicity of only needing to replace the nova
directory when updating to the latest version.)
When it comes to controllers, you’ll find that all of Nova’s core controllers are located in the nova/modules/core/controllers
directory. To avoid naming conflicts, all of Nova’s core controllers are prefixed with nova_
.
nova
directory.
When it comes to controllers, all of Nova’s application controllers are located in the application/controllers
directory. Nova comes with all of the needed controllers out of the box, but if you want to create new sections with new pages, you can add your own controllers here.
foo
will map to a page with the URI of /main/foo
). This also means is that you can override any existing method with one of your own by adding a method of the same name in your application controller.
$data
$data
. This array stores things like language items, form fields and controls, raw information out of the database, and much more. The odds are that anything you want to do or change is stored in the $data
array.
Template::render()
call, you can write die(var_dump($data));
to stop executing the code and see what’s in the $data
variable.$data
is sent to the view in its entirety, this also means that if you want to add additional data to a view, you can simply assign it to a key on the $data
array and you’ll have access to it in the view files using the key name as the variable.
$js_data
$js_data
array. Everything mentioned above applies to Javascript data.
nova/modules/core/libraries/Nova_template.php
file in your Nova installation to learn more.title
- The title of the page used in the head
of the HTML page_redirect
javascript
- The Javascript for the pagenav_main
- The main navigation for the pagenav_sub
- The secondary navigation for the pageflash_message
- Flash messages for indicating success/failure after a create, edit, or delete actioncontent
- The content of the pageajax
- Secondary content for the page in the way of modal pop-upscontent
, javascript
, and title
.