Skip to content

Using the routing system

danielgolub edited this page Nov 28, 2014 · 4 revisions

Codengine provides two ways to navigate through your system:

  • Normal routing (eg. index.php?page=welcome)
  • SEO friendly routing (eg. /welcome) - Default

You can switch between them through your /app/config.php file on line 12.

The routing system is easy to use. Every controller file you create (in /app/controllers) will be accessible through your website. The webpage will first load the action_index() function. Each controller has to contain the following theme:

<?php
/*
 * Codengine
 * FilePath: app/controllers/name.controller.php
*/

class controller_name
{
	public function __construct($params)
	{
               $registry = Registry::getInstance();
               foreach (reset($registry) as $key => $value) { $this->{$key} = $value; }
	}

	public function action_index()
	{
		
	}
}

?>

In order to set your default controller, please edit the /app/config.php file in line 11.

Clone this wiki locally