Skip to content
defvayne23 edited this page Jan 13, 2012 · 6 revisions

controller()

Description

object $this->load->controller(string $controller);

Loads the given controller.

Parameters

  • controller
    Name of the controller to load.

Returns

Returns the object of the controller.

Examples

$oProducts = $this->load->controller("products");

model()

Description

mixed $this->load->model(string $model[, string $variable_name]);

Loads the given model.

Parameters

  • model
    Name of the model to load.
  • variable_name
    If set, loads the model into the application instead of returning the object.

Returns

Returns the object of the model if variable name is not set.

Examples

$oProducts = $this->load->model("products");
$oProducts->getProduct(1);
$this->load->model("products", 'prod');
$this->prod->getProduct(1);

view()

Description

string $this->load->view(string $template);

Loads the given view.

Parameters

  • view
    Name of the view file to load.
  • arguments
    Data that is loaded for the view to use.
  • return
    If contents of view should be returned, otherwise sent to the browser.

Returns

Returns the contents of the view after rendering if return parameter is set to true.

Examples

$this->load->view("products.php", array('aProducts' => array(...)));
$this->load->view("email.php", array('aProducts' => array(...)), true);

helper()

Description

void $this->load->helper(string $helper);

Loads the given helper.

Parameters

  • helper
    Name of the helper to load.

Examples

$this->load->helper("tax");

$tax = calculate_tax($subTotal);

< Back to Index

Clone this wiki locally