Skip to content

MY_Router

Mathieu Nayrolles edited this page Jan 20, 2016 · 1 revision

MY_Router

Router Class

Parses URIs and determines routing

  • Class name: MY_Router
  • Namespace:
  • Parent class: CI_Router

Properties

$config

public object $config

CI_Config class object

  • Visibility: public

$routes

public array $routes = array()

List of routes

  • Visibility: public

$class

public string $class = ''

Current class name

  • Visibility: public

$method

public string $method = 'index'

Current method name

  • Visibility: public

$directory

public string $directory

Sub-directory that contains the requested controller class

  • Visibility: public

$default_controller

public string $default_controller

Default controller (and method if specific)

  • Visibility: public

$translate_uri_dashes

public boolean $translate_uri_dashes = FALSE

Translate URI dashes

Determines whether dashes in controller & method segments should be automatically replaced by underscores.

  • Visibility: public

$enable_query_strings

public boolean $enable_query_strings = FALSE

Enable query strings flag

Determines whether to use GET parameters or segment URIs

  • Visibility: public

Methods

_set_request

void CI_Router::_set_request(array $segments)

Set request route

Takes an array of URI segments as input and sets the class/method to be called.

  • Visibility: protected
  • This method is defined by CI_Router

Arguments

  • $segments array - <p>URI segments</p>

__construct

void CI_Router::__construct($routing)

Class constructor

Runs the route mapping function.

  • Visibility: public
  • This method is defined by CI_Router

Arguments

  • $routing mixed

_set_routing

void CI_Router::_set_routing()

Set route mapping

Determines what should be served based on the URI request, as well as any "routes" that have been set in the routing config file.

  • Visibility: protected
  • This method is defined by CI_Router

_set_default_controller

void CI_Router::_set_default_controller()

Set default controller

  • Visibility: protected
  • This method is defined by CI_Router

_validate_request

mixed CI_Router::_validate_request(array $segments)

Validate request

Attempts validate the URI request and determine the controller path.

  • Visibility: protected
  • This method is defined by CI_Router

Arguments

  • $segments array - <p>URI segments</p>

_parse_routes

void CI_Router::_parse_routes()

Parse Routes

Matches any routes that may exist in the config/routes.php file against the URI to determine if the class/method need to be remapped.

  • Visibility: protected
  • This method is defined by CI_Router

set_class

void CI_Router::set_class(string $class)

Set class name

  • Visibility: public
  • This method is defined by CI_Router

Arguments

  • $class string - <p>Class name</p>

fetch_class

string CI_Router::fetch_class()

Fetch the current class

  • Visibility: public
  • This method is defined by CI_Router

set_method

void CI_Router::set_method(string $method)

Set method name

  • Visibility: public
  • This method is defined by CI_Router

Arguments

  • $method string - <p>Method name</p>

fetch_method

string CI_Router::fetch_method()

Fetch the current method

  • Visibility: public
  • This method is defined by CI_Router

set_directory

void CI_Router::set_directory(string $dir, boolean $append)

Set directory name

  • Visibility: public
  • This method is defined by CI_Router

Arguments

  • $dir string - <p>Directory name</p>
  • $append boolean - <p>Whether we're appending rather than setting the full value</p>

fetch_directory

string CI_Router::fetch_directory()

Fetch directory

Feches the sub-directory (if any) that contains the requested controller class.

  • Visibility: public
  • This method is defined by CI_Router
Clone this wiki locally