Page 1 of 1

[solved] Odd issue attempting to install custom module

Posted: Sat Jan 21, 2012 8:51 am
by Malactus
Greetings!

I am new at using CMS Made simple. I am trying to follow tutorial for developing a simple video management module for a website I am working on. Currently the module is Rather simple, however I havent been able to install the module into CMS MS. I am using XAMPP as a local testing server and the latest version of CMSMS.

When attempting to install the module I get the following error:
Notice: Trying to get property of non-object in C:\xampp\htdocs\cmsms\lib\adodb_lite\adodb.inc.php on line 156

Warning: include_once(C:\xampp\htdocs\cmsms\lib\adodb_lite/adodbSQL_drivers//_datadict.inc) [function.include-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\cmsms\lib\adodb_lite\adodb.inc.php on line 158

Warning: include_once() [function.include]: Failed opening 'C:\xampp\htdocs\cmsms\lib\adodb_lite/adodbSQL_drivers//_datadict.inc' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\cmsms\lib\adodb_lite\adodb.inc.php on line 158

Fatal error: Class 'ADODB2_' not found in C:\xampp\htdocs\cmsms\lib\adodb_lite\adodb.inc.php on line 161
It appears to bug out immedietly when I use the line
$this->cms->db

The Code for installation is here

Code: Select all


	function Install (){
		
		$db = $this->cms->db;												// Creates a Reference to the database
		
		$taboptarray = array ( 'mysql' => 'TYPE=MyISAM' );	// if MySQL, sets database type to MyISAM
		
		
		$dict = NewDataDictionary($db);									// ADODB Dictionary = Table
		
		//  Entries Table
		$fields = 	"id I KEY, name C(128), description X, date_added T, user_id I, auth L";
										
		
		// Create Table
		
		$sqlarray = $dict->CreateTableSQL( cms_db_prefix().'module_'.$this->moduleName.'_entries', $fields, $taboptarray);
		$dict->ExecuteSQLArray($sqlarray);
		$db->CreateSequence(cms_db_prefix().'module_'.$this->moduleName.'_entries_seq');
		
		
		// Files TAble
		$fields 	 =  "id I KEY, video_id I, type I, src C(256), resolution C(32)";
		
		// Create Table
		$sqlarray = $dict->CreateTableSQL( cms_db_prefix().'module_'.$this->moduleName.'_files', $fields, $taboptarray);
		$dict->ExecuteSQLArray($sqlarray);
		
		$db->CreateSequence(cms_db_prefix().'module_'.$this->moduleName.'_files_seq');
		
		
		// Permissions
		
		$this->CreatePermission('Video Admin', 'Manage Videos');
		
	}
Anyone see anything wrong which may cause the error above? The code is otherwise very similar to the material in the tutorial.

Re: Odd issue attempting to install custom module

Posted: Sat Jan 21, 2012 11:20 pm
by Jos
I guess that tutorial is a bit out of date. Better take your example from a working module like News.

Code: Select all

$db = $this->cms->db;
should be

Code: Select all

$db = cmsms()->GetDb();

Re: Odd issue attempting to install custom module

Posted: Sun Jan 22, 2012 9:56 am
by Malactus
Thanks, that fixed it.