Jump to content

How to check if we are on homepage ?


Recommended Posts

Hello Everyone.

In my globalTemplate i want to check either we are viewing the home page or not.

In my scenario i have a slider block which i put in globalTemplate and i want to check if the page is home page then show the slider and if not then just print out ips_container.

In IPB 3.4.x there is a option like $test = $this->registry->ccsFunctions->getPageName(), so it will return the page name with extension like index.html.

So guys what options are available in new version, that will do this job.

Thanks. Much Appreciated your Kind Help.

Link to comment
Share on other sites

{{if $isForumIndex = \IPS\Dispatcher::i()->application->directory === 'cms' && \IPS\Dispatcher::i()->module === 'pages' && \IPS\Dispatcher::i()->controller === 'page' && \IPS\Dispatcher::i()->view === 'home'}}
Not HomePage

Basically i want the current page which is set to default page, In my case my default page name is home, so i have to first get the name and then check if its true.

I have slightly modified your code, but not working for me. Kindly check if you could find any mistakes in it.




Link to comment
Share on other sites

On this forum someone have also tried this out in this way : 

$location['app'] == 'cms' and $location['module'] == 'pages' and $location['controller'] == 'page' and \IPS\Request::i()->id == x}}

where my page id is 10. 

But still no success.

Please Help Thanks.

Link to comment
Share on other sites

  • 2 months later...
  • 2 years later...


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...