My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
API  
Influx API's explained
Phase-Implementation
Updated Feb 4, 2010 by guig...@gmail.com

Controller

Variables

  • $autoRender
Default is true
  • $description
  • $argv
  • $data
  • $layout
Default is default
  • $action
  • $name

Methods

  • after()
Occurs after the action has been processed (and before autorendering)
  • before()
Occurs before processing the desired action
  • missing()
Called when a method is missing (not callable)
It's important to notice that all the controller parameters (form data, action, argv) are already set at this point
  • render($action)
May be called explicitly to render an action.
Note: after an action is rendered $this->autoRender is set to false (you shouldn't need to render two actions on the same run)
  • set($name, $value)
Sets $name so the view can access it.

Helper Functions

  • css($file)
Inserts a link to a css file ($file is into /app/html)
  • img($file)
Inserts an image tag () ($file is into /app/html)
  • isAjax()
Returns true if this in an AJAX request
  • js($file)
Inserts a script tag ($file is into /app/html)
  • load($file, [$params])
Loads a file from APP/lib
load("mylib.php"); // loads /app/lib/mylib.php
load("somesubdir/lib.php")  // loads /app/lib/somesubdir/lib.php
If $params is set (an array of key/value pairs) all the $key variables are exported to the script, so, it is possible to load() custom components on a view, passing variables to them.
  • redirect($to)
Redirects the user to another controller/action.
$to is the URL to go to, in the controller/action/parameters form
  • url($to)
Returns the right url for the controller/action passed
$to is the URL to go to, in the controller/action/parameters form
For example, one might use
<form action="<?=url('/products/sell')?>" method="post">
 [...]
To post data to the sell() action in ProductsController.
  • session($name, [$value])
Reads or writes to the session
$name Is the name of the variable to store, $value is the value for that variable, if empty returns the variable's value
For example
session('user', 'User Name'); // saves "User Name" to the session
[...]
$user = session('user'); // user is "User Name"

Sign in to add a comment
Powered by Google Project Hosting