CodeIgniter Forums
How to find out user is in index - 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: How to find out user is in index (/showthread.php?tid=52071)



How to find out user is in index - El Forum - 05-29-2012

[eluser]Hamed[/eluser]
Hello,
I need a condition which tell me user is in index.php or root.
http://127.0.0.1
http://127.0.0.1/index.php



How to find out user is in index - El Forum - 05-29-2012

[eluser]animatora[/eluser]
That would be your default controller


How to find out user is in index - El Forum - 05-29-2012

[eluser]Pedro Luz[/eluser]
something like this?

Code:
$this->load->helper('url');
if(index_page() == current_url()) echo "user is at root";

take a look at http://ellislab.com/codeigniter/user-guide/helpers/url_helper.html


How to find out user is in index - El Forum - 05-29-2012

[eluser]Hamed[/eluser]
does not work for me.


How to find out user is in index - El Forum - 05-29-2012

[eluser]Samus[/eluser]
[quote author="Hamed" date="1338301679"]does not work for me.[/quote]
because you haven't defined index_page().
do something like..

Code:
$index_page = '/';
then
Code:
$this->load->helper('url');
if($index_page == current_url()) echo "user is at root";



How to find out user is in index - El Forum - 05-29-2012

[eluser]weboap[/eluser]
http://ellislab.com/forums/viewthread/105744/#570960

your index is a method in controller.