Stephan,

On Thu, 2002-12-19 at 11:42, Stephan Elsner wrote:
> > > When I try to call the navigation method, midgard reports "
> > > MGD_ERR_NOT_CONNECTED".
> > > Can I connect to midgard manually?
> >
> > You need the mgd_init patch to be able to access Midgard
> > database from ordinary PHP files.
> 
> Oh dear, no way without recompiling?
> I cannot recompile midgard on that system, I think I need to access the
> midgard db-tables directly from php.

There is a trick around it:

suppose your native php application is available from
http://somehost/myapp/ wich will call index.php.

- create a host in midgard that will respond to requests for
http://somehost/
- create an _active_ page /myapp/, with an empty style.

in that page, have code like:

<?php
  if ($argc == 0)
  {
    include("$DOCUMENT_ROOT/myapp/index.php");
  }
  else
  }
    include("$DOCUMENT_ROOT".$midgard->uri);
  }
?>

In this way, the initialization is done by midgard, and your midgard
functions will be available from within the flat files. Of course, the
above is a very stripped version. You'd want to implement some checks
and error handling to see if the file exists before including it, and
you want to make sure that you don't include any get-variables in the
last include line.

wkr,
 
-- 
Envida                     http://www.envida.net/
Armand A. Verstappen       Graadt van Roggenweg 328
[EMAIL PROTECTED]       3531 AH Utrecht
tel: +31 (0)30 298 2255    Postbus 19127
fax: +31 (0)30 298 2111    3501 DC Utrecht

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to