Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Show block only on the startpage for Databases


Recommended Posts

  • Owner

Sometimes you want to show a block only on the start page of a database and since if you add a block to the template it show up everywhere in the database, that can be annoying. Don't worry though, there is an easy fix for this.

In your block add this as the first line:

{{if \IPS\Request::i()->app == 'cms' and \IPS\cms\Databases\Dispatcher::i()->categoryId == 0}}

Then close it with {{endif}} on the last row.

This little snippet will check to see if you are in a category or not. On the start page you are not in a category yet, so the result will be 0. On all other pages this check will not be true, so it will not show there.

You can use this to target specific categories as well, or show things everywhere else but on the start page.

 


View full record

Link to post
Share on other sites
  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...