Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted April 11, 20169 yr 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 4.1.1.0 version, that will do this job. Thanks. Much Appreciated your Kind Help.
April 11, 20169 yr {{$isForumIndex = \IPS\Dispatcher::i()->application->directory === 'forums' && \IPS\Dispatcher::i()->module === 'forums' && \IPS\Dispatcher::i()->controller === 'index';}} should work, though I haven't tested it.
April 11, 20169 yr Author {{if $isForumIndex = \IPS\Dispatcher::i()->application->directory === 'cms' && \IPS\Dispatcher::i()->module === 'pages' && \IPS\Dispatcher::i()->controller === 'page' && \IPS\Dispatcher::i()->view === 'home'}} HomePage {{else}} Not HomePage {{endif}} 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. Thanks. Regards
April 11, 20169 yr Author 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.
April 11, 20169 yr Author Thanks for your help. I am somehow get this in working with following code. {{if $home = \IPS\cms\Pages\Page::$currentPage->id == 10}} home {{else}} nothome {{endif}} Regards
July 8, 20168 yr I use: {{if (\IPS\Request::i()->url()->data['path']) == "/"}} Code only on Homepage {[endif}}
Archived
This topic is now archived and is closed to further replies.