Setting up the controller
This is, most likely, one of your first forays into Nova’s controllers. You can think of controllers in Nova like a traffic cop; the web browser navigates to a URL at which point the traffic cop (the controller) tells you where to go from there. A controller is simply a PHP class that directs a request to the appropriate place. In order to build our page, we need a little bit of code in our controller. To start, we’re going to openapplication/controllers/Sim.php
. This is the controller that handles all of the pages in the sim section. When you first open the file, you’ll notice that it’s almost empty. The core sim pages are actually stored in a file tucked away in Nova’s core. Since we’re not interested in modifying those, we’re going to add a new method to this class right after the comment about adding your own methods.
Setting up the view
If you tried to navigate to your page above, you’d be greeted with an error telling you something is missing. What we’re missing is the guts of the page, or the view file. The second part of this is to create your view file. To do that, we’re going to create a file calledsim_allawards.php
in application/views/_base_override/main/pages
.
What are we going to put in our view file?

base_url
to get the base URL of our site. (If we don’t use the base URL, CodeIgniter will try to append index.php
to our image path and it won’t be able to find the image.)
With this foundation, you can make whatever changes you want to the view file and continue to add awards or style it however you’d like. Because we’ve done all this work in the application
directory, we don’t have to worry about losing our changes when we make an update either!
Understanding the controller code
Let’s walk through the code we used in the controller to see what’s going on.index.php/sim/allawards
. You can name your controller action whatever you want provided it doesn’t conflict with another method in that particular controller or that it isn’t a reserved PHP word.
content
region. We’re assigning a view file to the content region to be rendered by the browser. It may sound complicated, but it’s pretty simple. All you need to know is the second part: the Location
class.
In order for seamless substitution to work, we’ve created the Location
class that does all the heavy lifting of figuring out where to pull files from. In this case, we’re looking for a view that’s named sim_allawards.php
(the .php part is assumed so you don’t have to include it). After that, the Location
class is simply being told where to look and what section it’s a part of.