CodeIgniter Forums
Question about controller[SOLVED] - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Question about controller[SOLVED] (/showthread.php?tid=22320)



Question about controller[SOLVED] - El Forum - 09-05-2009

[eluser]Hitesh Chavda[/eluser]
Hi

I have little question about controller in CI

I have function some like below in main controller
Code:
function check_user_name()
{

     //code

}

now when i type http://localhost/check_user_name/ it execute, I know the work of controller but how to block only that function to behave only like function rather than url.

I know this type of functions should actually write in Models but now I can't move it.


Question about controller[SOLVED] - El Forum - 09-05-2009

[eluser]pistolPete[/eluser]
User guide:

Quote:In some cases you may want certain functions hidden from public access. To make a function private, simply add an underscore as the name prefix and it will not be served via a URL request. For example, if you were to have a function like this:

Code:
function _utility()
{
  // some code
}



Question about controller[SOLVED] - El Forum - 09-05-2009

[eluser]Hitesh Chavda[/eluser]
Thank you very very much...


Question about controller[SOLVED] - El Forum - 09-05-2009

[eluser]alboyd[/eluser]
PistolPete - Well done! Your ability to understand the question astounded me. GW Smile