Welcome Guest, Not a member yet? Register   Sign In
get_class_name
#5

[eluser]PhilTem[/eluser]
I use this code in MY_Model which returns the name of the class that extends MY_Model

Code:
/**
* Returns the name fhe instantiated class
*
*
* @access protected
*
* @param bool $ucfirst Whether to upper-case the first character
*
* @return string Returns the classes name
*/
protected function _class_name($ucfirst = FALSE)
{
    return ( $ucfirst ? ucfirst(get_class($this)) : get_class($this) );
}

Maybe it helps you Wink

For non-instantiated classes you might need to replace $this with self, but dunno if this code snippet works with non-instantiated classes Wink


Messages In This Thread
get_class_name - by El Forum - 07-23-2012, 03:43 AM
get_class_name - by El Forum - 07-23-2012, 06:20 AM
get_class_name - by El Forum - 07-23-2012, 06:54 AM
get_class_name - by El Forum - 07-23-2012, 07:02 AM
get_class_name - by El Forum - 07-23-2012, 07:05 AM
get_class_name - by El Forum - 07-23-2012, 07:42 AM
get_class_name - by El Forum - 07-23-2012, 10:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB