Welcome Guest, Not a member yet? Register   Sign In
Any integrated way in CodeIgniter how to check if I am on a homepage?
#1

[eluser]term25[/eluser]
I mean I am looking for CI equivalent of WP is_home() or is_front_page() function?

Is there something like that? I mean I would like to do something simple such as:

Code:
<?php if(is_home()) echo 'This is homepage'; ?>

Thanks in advance.
#2

[eluser]Aken[/eluser]
There's no specific function for that, but you can create a helper to do it. You'd use something like $this->uri->uri_string() to see what the current URL is, and compare that to what your homepage URL woud be (typically an empty string, or "index.php").
#3

[eluser]term25[/eluser]
Thanks it is working Wink :

Code:
if($this->uri->uri_string() == '') echo 'This is homepage');


I will create a helper for future use.




Theme © iAndrew 2016 - Forum software by © MyBB