Sometimes, the built-in pages in Nova won’t be enough and you need to create a new page for you sim to hold new information
application/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.
sim_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!
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.