GrooveOnBeat Posted June 26, 2016 Share Posted June 26, 2016 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 More sharing options...
GrooveOnBeat Posted June 27, 2016 Author Share Posted June 27, 2016 I've tried different combinations too, including below, and none worked. $category->_id == 'x' In all cases I can call up the record id, but not the database id. What am I missing? Link to comment Share on other sites More sharing options...
GrooveOnBeat Posted June 28, 2016 Author Share Posted June 28, 2016 I've also tried and didn't work.. $database->_id == 'x' $category->database_id == 'x' $databases->_id == 'x' $databases->databases_id == 'x' $databases->_database == 'x' Link to comment Share on other sites More sharing options...
GrooveOnBeat Posted June 29, 2016 Author Share Posted June 29, 2016 I also tried and failed $location->_id == 'x' $location->location_id == 'x' $location->database_id == 'x' Link to comment Share on other sites More sharing options...
newbie LAC Posted June 29, 2016 Share Posted June 29, 2016 Try again On 26.06.2016 at 5:33 PM, GrooveOnBeat said: I want to go one step further and call a record id from x database.. How? db contain many articles. Which template you edit? Link to comment Share on other sites More sharing options...
GrooveOnBeat Posted June 29, 2016 Author Share Posted June 29, 2016 Thank you for replying! I edited in globalTemplate. Link to comment Share on other sites More sharing options...
newbie LAC Posted June 29, 2016 Share Posted June 29, 2016 13 minutes ago, GrooveOnBeat said: I edited in globalTemplate. You can't get article id when you viewing db. Maybe there is another way. Provide more info Link to comment Share on other sites More sharing options...
GrooveOnBeat Posted June 29, 2016 Author Share Posted June 29, 2016 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. Link to comment Share on other sites More sharing options...
newbie LAC Posted June 29, 2016 Share Posted June 29, 2016 Use to define database ID \IPS\cms\Databases\Dispatcher::i()->databaseId Link to comment Share on other sites More sharing options...
GrooveOnBeat Posted June 29, 2016 Author Share Posted June 29, 2016 9 minutes ago, newbie LAC said: Use to define database ID \IPS\cms\Databases\Dispatcher::i()->databaseId Wow! That did the trick! I wish I could give you 1000 likes. Thank you newbie LAC once again for saving the day! \IPS\cms\Databases\Dispatcher::i()->databaseId == x Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.