Back to Littlefoot Manual

Littlefoot Class

This class is responsible for executing the CMS, providing URL parts to apps and skins, URL routing to class methods or app index.php, and rendering app execution results in a defined skin.


This auto-runs the entire CMS process. Uses the lf_actions and lf_links to print app output into a theme.

public function cms()
    $this->db = (new orm)->initDb();    // set up local db object, backward compatible. 
                                            // modern apps do not rely on $this->db to do db stuff. the orm class is used instead.

    (new install)->test();              // test that we can connect to the db and have data, 
                                            // otherwise present db config form

    $this->loadVersion()                // load version from LF/system/version file
        ->loadPlugins()                 // load plugins from `lf_plugins` table
        ->loadSettings()                // load settings from `lf_settings` table
        ->request()                     // Parse $_SERVER['REQUEST_URI']; into pieces Littlefoot can understand
        ->route('auth', '_auth', false) // Route auth() class per $wwwIndex/_auth/$method
        ->loadACL()                     // load ACL rules from lf_acl_global, lf_acl_inherit, and `lf_acl_user` that affect current $_SESSION user.
        ->routeAdmin()                  // If /admin was requested, load it and stop here
        ->navSelect()                   // Get data for SimpleCMS, or determine requested Nav ID from url $actions
        ->getcontent();                 // Deal with SimpleCMS or execute linked apps

    echo $this->render();               // Display content in skin, return HTML output result

    return $this;


Using a regex pattern against the REQUEST_URI,

// Detect subdirectory, use of index.php, request of admin, other URI variables and the GET request
$urlregex = '/^(\/'.str_replace('/', '\/', $subdir).')(.+.php\/)?(admin\/)?(.*)/';
preg_match($urlregex, $url[0], $request);

// Simplify request matches
$subdir = $request[1];
$index  = $request[2];
$admin  = $request[3];
$action = $request[4];

This method determines several things about the page request:

$this->lf->domain = $_SERVER['HTTP_HOST'];

$this->lf->wwwInstall     = $protocol.$_SERVER['HTTP_HOST'].$subdir;

$this->lf->wwwLF     = $protocol.$_SERVER['HTTP_HOST'].$subdir.'lf/';

$this->lf->wwwIndex     = $protocol.$_SERVER['HTTP_HOST'].$subdir.$index;

$this->lf->wwwAdmin     = $this->wwwIndex.'admin/';

And everthing after the subdirectory is treated as a navigation request:

// explode the remaining URL component to see what was requested, delimiting on '/'
$this->action = explode('/', $action, -1);
if(count($this->action) < 1) // If the action array has no elements,
    $this->action[] = '';    // Set first action as alias '' (empty string)

Though in the route() or navSelect() method, we can see $this->action[] possibly split further.


In Github

This acts as a url-method map to an app controller class.

Create a folder at LF/apps/myapp. Place this in your index.php:

echo $this->lf->mvc('myapp_index');

If myapp is assigned to navigation alias /myLoadedApp,

A URI of /myLoadedApp/view/1, when using the above code will

  • change directory to LF/myapp,
  • include controller/myapp_index.php
  • initialize class, execute method view(), with arguments array('view', '1');


The route() method, allows you to directly map any action array into an app controller class.

public navSelect()

public getContent()

This is where mvc gets called.

public render()

  • <?=$this->lf->getTitle();?>
  • <?=$this->lf->getSkinBase();?>
  • <?=$this->lf->printContent('nav');?>
  • <?=$this->lf->printContent('content');?>
blog comments powered by Disqus