Nova NextGen: Pages 31 Jan 2015

It's an inevitable truth that people want to take their installation of Nova and make it their own. The easiest way to do that is with new pages. I've always struggled with how to do this. In SMS, there was the database feature and in Nova there's the wiki. With both of these features, admins had somewhere to put their content for users to get at. Unfortunately, those weren't always ideal places to put things, so another solution was needed. In Nova, more and more users have taken to creating custom pages, but that involves code and knowing your way around PHP; most admins don't. What's really needed most is a better page system.

Pages involve a lot of different pieces. First, there's the URI of the page (how you get there), the resource it uses (its controller, HTTP resource), the page title, the header, content, navigation, and the list goes on. My first stab at this was to create admin pieces for all of these things, but after getting some work done on it, I stepped back and felt like you were looking at individual pieces of a larger puzzle. Things were still too spread out and didn't feel connected enough. I wanted something that felt more connected and was more of a one-stop-shop than needing to bounce around to several different places.

Point in case? If you wanted to change the page title and header for a page, you'd go to the same section, but have to find those two pieces of information in two different places. Want to change the title, header, and resource a page uses? Two totally different sections of the admin control panel. It felt like I was making things more difficult than they needed to be. So why not make it simpler?

Enter the Page Manager.

The Page Manager is the end-all, be-all of pages. Every single page in Nova NextGen is in the Page Manager. Everything you could possibly want to do with pages is in here. Change the page title? Change the header? Update intro content? Change the URI? Change the resource? Update the navigation? All of it is in the page record in Page Manager. But it goes further than that.

Some pages are dynamic and need code, but some are just static information. Why should static information pages need a controller and all this code and complexity around them? They shouldn't. The Page Manager is the answer to this problem. If a page doesn't have a resource (controller) attached to it, you'll still be able to use the content section to put all your information in. Want to create a new page? Just add a new record, give it a URI, title, header, and some content and you're done. The idea here is to make creating new pages as simple as possible.

But, it goes even a little further. Static content is great, but sometimes there are little pieces of dynamic content that you want to include in your pages, like a sim name or sim year or a link to another page. You could hard-code those in, but what if that information changes? What are the odds you're going to remember to go into that page you created 6 months ago to make the change to that one sentence? My guess is you won't until someone points it out to you. So how do we solve this without forcing users to build controllers and such just for a little dynamic content? Why, you build a page compiler engine to take care of that kind of thing!

While "page compiler engine" probably sounds like Greek to most of you, it's actually a pretty simple idea. You'll be able to embed special tags into your site content and NextGen will take those tags, parse them out, and replace them with what it's supposed to. Here are a few examples:

  • {% setting:sim\_name %} will go out to the settings table and pull back the sim name and replace the tag with the correct value. Since every setting has a "key", all you need to do is reference that key and Nova will take care of the rest!
  • {% form:eoyawards %} will grab that End of Year Awards voting form you created for your users and embed it into the page. Users will be able to fill it out, submit it, and everything without you writing a single line of code.
  • {% page:game.rules %} will grab the page record that has a "name" of "game.rules" and build a link to that page. If the URI changes, so does your link!

The compiler engine is written in such a way that I'll be able to build new compilers and add new functionality along the way that users will be able to add to their pages with just a few simple strokes. What's even better? That same mechanism will allow third-party developers to add additional compilers as well!

The Page Manager is a big step forward in making Nova more of a content management system than it's been to date and gives admins more control than they've ever had before!