Author Topic

Bruce Morrison

Friday 23 February 2007 4:36:21 pm

Comment47822

Hi Nathan

Part of the trouble is that we are lacking context. From what your've described I'm not sure you need to use ezpersistantobject. ezpersistantobject is a object persistance library that does provide great savings if it's used with data that suits. I'm not sure your case does.

If all you want to do is extract from information from the database and say display in a template you can simply do something like the following:

// Grab some data from the DB
$query = "SELECT DISTINCT tableOne.*
FROM tableOne, tableTwo
WHERE tableOne.myObjectID
IN (tableTwo.myObjectID)
ORDER BY myObjectName ASC";
$db =& eZDB::instance();
$result =& $db->arrayQuery($query);

//Make data availiable to template
$tpl =& templateInit();
$tpl->setVariable( 'result', $result );
$Result['content'] = $tpl->fetch("design:path/to/template.tpl");

This code would suite a module view. It sets a temaplte variable $result that would contain an array with an array per row returned from the query. Each row is an array with the column names as keys. Use {$result|attribute(show,3)} in the template to have a look.

If this is still not what you are looking for I think you need to describe what you are tring to do so we have some context to work with.

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish