[solved] Odd issue attempting to install custom module

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
Malactus
New Member
New Member
Posts: 2
Joined: Sat Jan 21, 2012 8:42 am

[solved] Odd issue attempting to install custom module

Post 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.
Jos
Support Guru
Support Guru
Posts: 4019
Joined: Wed Sep 05, 2007 8:03 pm
Location: The Netherlands

Re: Odd issue attempting to install custom module

Post 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();
Malactus
New Member
New Member
Posts: 2
Joined: Sat Jan 21, 2012 8:42 am

Re: Odd issue attempting to install custom module

Post by Malactus »

Thanks, that fixed it.
Post Reply

Return to “Developers Discussion”