CodeIgniter Forums

Full Version: question about controller's contructure function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]datactrl[/eluser]
HI, all

Is that possible on my controller's contructure function, to get information about which function is requestion on current request? Thank you!

Jack

El Forum

[eluser]jedd[/eluser]
Code:
echo $this->uri->segment(2);


?

Of course, you'll know which function has been called, cos you'll be *in* it.

El Forum

[eluser]datactrl[/eluser]
Thank you, jedd

jack

El Forum

[eluser]jedd[/eluser]
Was that the answer? That was easy! Smile

Note that if you start grouping your controllers into sub-directories, or start doing any funky routes etc .. this method won't work reliably for you anymore. I suspect you're probably not about to do that kind of stuff just yet, though.

El Forum

[eluser]datactrl[/eluser]
Thanks, Jedd. I noticed that. I do use subfolder to grouping controllers. So have to take care about which segment is the right one for the function name.