Nova 1 Developer Resource

A library is just a normal PHP class. It doesn't need to extend anything or follow any conventions. In Nova, libraries are stored in application/libraries and have the first letter of the filename capitalized. Our example library would look like this:

class Example {
	function Example()
		log_message('debug', 'Example Library Initialized');

You can add methods to your library like you normally would. Since Nova follows PHP 4 compatability, visibility keywords (public, private, protected) aren't available. If you want to make a method private (in a psuedo manner), simply append an underscore to the beginning of the method name. For instance, if we wanted a private method to add some numbers up, the name of the method would be _add.

Loading a library

To load a library from your controller or model (you should never load a library from a view file), you'll need to manually call the load method, like this:


Libraries in subdirectories

Libraries can be stored in subdirectories if you want to organize them in that way. If we wanted to store our example library in a directory called "test", we would load the library like this now:


Log in with your AnodyneID to rate this article or submit the article for review.