| 
                                                             Saturday 09 August 2003 7:02:11 am 
                                                            
                                                            
                                                                 Hi Tony ... I had stop this module , now am writeing new module for listing based on doc. tutorial .. the problem now is just looping and at the end i got page not found .. here is the code : 
module.php : 
------------------- <?php $Module = array( 'name' => 'Companies' ); 
$ViewList = array(); 
$ViewList['list'] = array( 
								'script' => 'list.php', 
								"unordered_params" => array( "offset" => "Offset" ) ); 
?> 
---------------- 
list.php: 
----------------- <?php $Module =& $Params['Module']; 
$Offset = $Params['Offset']; 
if ( !is_numeric( $Offset ) ) $Offset = 0; $viewParameters = array( 'offset' => $Offset ); 
include_once( 'kernel/common/template.php' ); 
$tpl =& templateInit(); $tpl->setVariable( 'view_parameters', $viewParameters ); 
$Result = array(); 
$Result['content'] = $tpl->fetch( "design:companies/list.tpl" ); 
$Result['path'] = array( array( 'url' => false, 
 'text' => 'Companies' ), 
 array( 'url' => false, 
 'text' => 'List' ) ); 
?> 
-------------------------- 
function_definition.php : 
-------------------------- <?php 
$FunctionList = array(); 
$FunctionList['list'] = array( 'name' => 'list', 
 'operation_types' => array( 'read' ), 
 'call_method' => array( 'include_file' =>  
 'extension/q8b2b/modules/companies/companyiesfunctioncollection.php', 
 'class' => 'CompaniesFunctionCollection', 
 'method' => 'fetchList' ), 
 'parameter_type' => 'standard', 
 'parameters' => array( array( 'name' => 'offset', 
 'required' => false, 
 'default' => false ), 
 array( 'name' => 'limit', 
 'required' => false, 
 'default' => false ) ) ); 
?> 
------------------------ 
companyiesfunctioncollection.php : 
------------------------------- <?php include_once( 'extension/q8b2b/modules/companies/companies.php' ); 
class CompaniesFunctionCollection { 
function CompaniesFunctionCollection() 
{ } 
function &fetchList( $offset, $limit ) 
{ 
 $parameters = array( 'offset' => $offset, 
 'limit' => $limit );  $lista =& Companies::fetchListFromDB( $parameters ); 
 return array( 'result' => &$lista ); } 
} 
?> 
---------------------------- 
companies.php 
--------------------------- <? 
include_once( 'kernel/classes/ezpersistentobject.php' ); 
include_once( "lib/ezdb/classes/ezdb.php" ); include_once( "lib/ezutils/classes/ezdebug.php" ); 
class Companies extends eZPersistentObject { 
 function Companies( $row ) 
 { 
 $this->eZPersistentObject( $row );  } 
 function &definition() 
 { 
  		$db =& eZDB::instance(); 
		$asObject = true; 
		 
		$query = "SELECT  
		ezcontentobject.id,  
		ezcontentobject.name,  
		ezcontentobject.owner_id,  
		ezcontentobject.published, 
		ezcontentobject.modified  
		FROM  
		ezcontentobject  
		WHERE  
		ezcontentobject.contentclass_id = '15' 
		ORDER BY ezcontentobject.id"; 
		 
		$class_name = "companies"; 
		$rows =& $db->arrayQuery( $query ); 
		return eZPersistentObject::handleRows( $rows, $class_name, $asObject ); 
					  } 
 function &fetchListFromDB( $parameters = array() ) 
 { 
 return Companies::handleList( $parameters, false );  } 
 function &handleList( $parameters = array(), $asCount = false ) 
 { 
 $parameters = array_merge( array( 'as_object' => true, 
 'offset' => false, 
 'limit' => false ), 
 $parameters ); 
 $asObject = $parameters['as_object']; 
 $offset = $parameters['offset']; 
 $limit = $parameters['limit']; 
 $limitArray = null; 
 if ( !$asCount and $offset !== false and $limit !== false ) 
 $limitArray = array( 'offset' => $offset,  'length' => $limit ); 
 return eZPersistentObject::fetchObjectList( Companies::definition(), 
 null, null, null, $limitArray, 
 $asObject );  } } ?> I think the error is with $class_name ... I get no dubeg to check the error .. to know what the wrong here :( any help please ?                                                             
                                                                                                                                                                                 |