To integrate midcom and midgard better we need to change the way requests are handled. Instead of having midgard decide which page should be executed, this should be handled by a combination of midgard and midcom.
Sample code:
// request starts, we ask for /page/somepage
Midgard has already set up the db connection.
Midgard executes some php code in the index.php file of the root dir.
in the index.php file:
// I'm not sure about the hostconfig part - if it is needed.
$hostconfig = new MidgardHostConfig?;
$hostconfig->use_basic_auth(); // require midgard basic auth
$request = new MigardRequest?;
This creates a new object that contains the following:
request->argv todays argv
request->argc "
request->page the page object that is linked to the request
request->style = the id of the style defined in the page object.
// midcom starts up.
// midcom creates the correct component to use
// midcom sets a different style if needed.
(example: if the url requested does not define the correct page )
$request->run()
//midgard starts the normal request handling phase calling
code-init
ROOT
etc.