Jump to content

Conditional for a Record ID in this Database ID


Recommended Posts

If I want to call a record id I use the following..

\IPS\Request::i()->id == x

I want to go one step further and call a record id from x database..

I tried the following but it did not work..

\IPS\Request::i()->database_id == x and \IPS\Request::i()->id == x

What can I use?

Link to comment
Share on other sites

10 minutes ago, newbie LAC said:

You can't get article id when you viewing db.

Maybe there is another way. Provide more info 

I'd like to change content from globalTemplate based on the record I'm viewing. So record 1 will have something different from record 2 and so on.

I've managed to change the content by the record id

\IPS\Request::i()->id == x

The conflicts come when there is another database with that same record id. So if database id 1 and id 2 have record id 3 the content will show up when viewing record id 3 from both databases.

I'd like to restrict content when viewing record 3 only when it's from database id 1.

I hope that helps. :lol:

Link to comment
Share on other sites

9 minutes ago, newbie LAC said:

Use to define database ID


Wow! That did the trick! :thumbsup:

I wish I could give you 1000 likes. Thank you newbie LAC once again for saving the day! :smile:

\IPS\cms\Databases\Dispatcher::i()->databaseId == x



Link to comment
Share on other sites


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

  • Recently Browsing   0 members

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