pagelib is easy to use, but does require some setup. First, we need to define a local pagelib.php
file. This is where we will define the new page type. This is done by extending the appropriate base class. Within this local copy, we need to include the main /lib/pagelib.php
file. Next, we must override at least two of the base class member functions: get_type
and quick_init
. After we have finished creating the file, we must include the local pagelib.php
file in the module's lib.php
file.
When the module's lib.php
file is included in its pages, the pages gain access to pagelib functions. This include will often be done in either the module's index.php
or view.php
file.
We can then create an instance of the class by calling page_create_instance()
, as follows:
function page_create_instance($instance) { page_id_and_class($id, $class); return page_create_object($id, $instance); }
This function uses the weblib function page_id_and_class()
to determine...