Welcome Guest, Not a member yet? Register   Sign In
Access to model functions throught custom library
#6

This is a code piece from CI itself. It is used in the CI_Model.

PHP Code:
/**
 * __get
 *
 * Enables the use of CI super-global without having to define an extra variable.
 *
 * @access public
 * @param $var
 * @return mixed
 */
public function __get($var)
{
 
¬† ¬†return get_instance()->$var;


Just place it in any class that requires the use of the CI super object.
Advantage of this approach is that you can keep coding like you would in your controllers
Reply


Messages In This Thread
RE: Access to model functions throught custom library - by Martin7483 - 02-01-2018, 07:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB