Forums / Developer / Initializing eZ when not using CLI or eZ publish
Atle Pedersen
Monday 14 May 2007 6:54:26 am
Hi,
I need to get some data from the eZ database using for example:$node =& eZContentObjectTreeNode::fetch( 2 );
However I am using a php program that is called directly from apache, and not from CLI nor from within eZ publish.
My guess is that I need to to some initializing of some sorts, but I don't know what.
Can anyone point me in the right direction?
Michael Maclean
Tuesday 15 May 2007 2:56:41 am
The minimum that I've managed to get away with so far has been:
include_once('lib/ezutils/classes/ezini.php'); include_once('lib/ezutils/classes/ezsys.php'); include_once('lib/ezdb/classes/ezdb.php'); include_once('access.php'); include_once( "lib/ezutils/classes/ezdebugsetting.php" ); include_once( "kernel/classes/ezcontentobjecttreenode.php" ); /*! Dummy function, required by some scripts in eZ publish. */ function eZUpdateDebugSettings( $useDebug = null ) { } $ini = eZINI::instance(); // This will get the default siteaccess name, or you can hard code it if you want // $siteaccess = 'accessname'; $siteaccess = $ini->variable( 'SiteSettings', 'DefaultAccess' ); $access = array( 'name' => $siteaccess, 'type' => EZ_ACCESS_TYPE_DEFAULT ); $access = changeAccess( $access ); $node = eZContentObjectTreeNode::fetch( 2 ); var_dump($node);
You will probably need to change the paths to the includes.
eZpedia community documentation project | http://ezpedia.org
Thursday 24 May 2007 6:23:59 am
Thank you Michael, this was excatly what I needed.