Welcome Guest, Not a member yet? Register   Sign In
Is there a way to get the controller name inside a view?
#3

[eluser]SpooF[/eluser]
Code:
get_class($this)

Will return the name of the class that $this belongs too. Only problem is that will return the first class the controller extends.

Code:
<?php
class A {
    function foo() {
      return get_class();
    }
}
class B extends A {
   function bar() {
      return get_class();
   }
}
$instance = new B();
echo $instance->bar(); //Prints 'B';
echo $instance->foo(); //Prints 'A';
?>


Messages In This Thread
Is there a way to get the controller name inside a view? - by El Forum - 06-12-2009, 11:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB