Prado and loading modules at runtime
Today I had big problems trying to load modules in Prado from the TPage, not using the application.xml. I had such a requirement for the globalization utility in our web application. So after hours of pain finaly I found the magic lines of code that allow this to happen. I am surprised that there was no entry in the documentation or in the forums .
Here is the code:
$doc = new TXmlDocument(); $doc->loadFromString(' <module id="db1"> <database ConnectionString="mysql:host=localhost;dbname=dbdb" Username="dbdb" Password="dbdb" /> </module> '); Prado::using('System.Data.TDataSourceConfig'); $db = new TDataSourceConfig(); $this->Application->setModule('db1',$db); $db->init($doc);
This post is also available in: Bulgarian