Defining the initial view

The initial view will be presented by index.php, which is located in the web server's document root. We include the Composer autoloader, initialize the variables, and set up the URL used by the view template index.phtml to make a jQuery DataTables query:

// autoloading include __DIR__ . '/../vendor/autoload.php'; use Application\Base; $start_date = 'now'; $end_date = ''; $limit = Base::DEFAULT_LIMIT; $ajax = Base::buildUrl($start_date, $end_date, $limit); include __DIR__ . '/index.phtml';

The Application\Base class is extended by three services classes which make the connection to the MongoDB database, perform lookups, and ultimately insert data. Autoloading is provided by Composer, which means that we need to identify ...

Get MongoDB 4 Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.