You are right. My initial reason for including WP was to avoid the hassle of navigating the db as well as dealing with formatting of the output.
I eventually figured out that the error was caused by program with the global keyword in php not functioning properly when I included WP within a function. So I ended up with a solution where I detect if the page requested needs WP and then include WP even before starting the Yii application. It’s not a very elegant solution but it works and the performance is decent enough for the site I’m working on.
But thanks for your response ??