Jane Lander Posted September 17, 2016 Share Posted September 17, 2016 I am writing a plugin for Nexus, and I want it to make changes to a DB not within the IPB ecosystem. I thought it would be a simple matter of just doing "$conn = new mysqli($servername, $username, $password, $dbname);" however that ends up erroring out with a "Class 'IPS\nexus\mysqli' not found" message. I suppose the question is, is there a way to tell the built in insert command in IPB (below) to modify another database not within the IPB ecosystem? Or is there another method of achieving the same result? \IPS\Db::i()->insert Link to comment Share on other sites More sharing options...
Daniel F Posted September 17, 2016 Share Posted September 17, 2016 You can always create a second \IPS\Db instance with the new connection details! All you have to do is to use a new identifier and to pass the connection settings as second param /** * @brief Multiton Store */ protected static $multitons; /** * Get instance * * @param mixed $identifier Identifier * @param array $connectionSettings Connection settings (use when initiating a new connection) * @return \IPS\Db */ public static function i( $identifier=NULL, $connectionSettings=array() ) { $conn = new mysqli($s would also work, but don't forget about the namespaces! It's $conn = new \mysqli($s Link to comment Share on other sites More sharing options...
Jane Lander Posted September 18, 2016 Author Share Posted September 18, 2016 Thanks, I also noticed that when I make a plugin that leverages these store classes, that members stop getting auto promoted if it is a setting specified in the product page. Do I need to manually add this to the code? Link to comment Share on other sites More sharing options...
TSP Posted September 18, 2016 Share Posted September 18, 2016 Difficult to answer without seeing what you extend etc. but you need to remember to return to the parent method, so the code in there is run. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.