Structure

From Snapp CMS Developer Documentation

Jump to: navigation, search

This page illustrates the sequence of events leading to a page load, and the locations of the files responsible for these events.

Page Loading Overview

SnappCMS's codebase is based on a hybrid modular MVC model.

Each page type is handled by a "module". A module is a collection of MVC components for a particular page type (see below).

The following basic steps are carried out on each request:

1. Each page request is bootstrapped by loading DOCUMENT_ROOT/index.php.

2. The bootstrapping code on this file looks as follows:

<?
include('cms/includes/cms.php');

$cms = new CRU_CMS_V2();

// Route the request and render the page
$cms->dispatch();

By default, the site master template (see Master_Templates) is stored in DOCUMENT_ROOT/templates/default/index.php.

3. Stripped down to its absolute basics, the template file would look something like the following:

<html>
  <head>
    <title><?php echo $cms->page->title?> - example.com</title>
  </head>
  <body>
    <?php include($cms->loadModule()); ?>
  </body>
</html>

The call to include($cms->loadModule()) launches the controller script for the module, which handles manipulating and displaying page-specific content. See Modules_Info for more information about modules.

Directory Structure

Here's an example directory structure for a SnappCMS-based site

  • / - DOCUMENT_ROOT'
  • custom/ - Directory of all Custom Scripts,Templates & Modules
  • logs/ - Site Activity Log Files
  • media/ - User Generated Content
  • modules/ - Modules Directory

...

Other modules

...

  • templates/
    • default/ - The default site template (see Master_Templates)
      • css/ - Site Specific or Custom CSS Style Sheets
      • javascript/ - Site Specific or Custom Javascript Libraries
Personal tools
Core Components
Standalone Installs