TheBigK
Well-known member
I'm following furrman's tutorial:- https://xenforo.com/community/resources/how-to-read-and-write-into-the-database-with-a-page.328/
I've created file/folder structure as follows:-
library / SimpleText / Installer.php
Installer.php code:-
I saved the file, then went to admin control panel and created a new addon with following Information:-
Add-on ID: SimpleTextAddon
Title: Simple Text Add On
Version String: 1.0
Version ID: 1
Installation Code: SimpleText_Installer :: install
Uninstallation Code: SimpleText_Installer::uninstall
When I click 'Save Addon', I'm getting an error in overlay that says -
I'm unable to figure out why is the system not accepting my class::method. Can someone tell me what's missing or wrong?
I've created file/folder structure as follows:-
library / SimpleText / Installer.php
Installer.php code:-
PHP:
<?php
class SimpleText_Installer
{
//Creating required tables in the database
// $table = array('createQuery', 'dropQuery')
protected static $table = array(
'createQuery' => 'CREATE TABLE IF NOT EXISTS `xf_simple_text` (
`simple_id` INT( 10 ) NOT NULL AUTO_INCREMENT,
`simple_text` VARCHAR ( 200 ),
`simple_date` INT( 10 ) UNSIGNED,
PRIMARY KEY (`simple_id`)
)
ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;',
'dropQuery' => 'DROP TABLE IF EXISTS `xf_simple_text`'
);
public static function install()
{
$db = XenForo_Application::get('db');
$db->query(self::$table['createQuery']);
}
public static function uninstall()
{
$db = XenForo_Application::get('db');
$db->query(self::$table['dropQuery']);
}
}
I saved the file, then went to admin control panel and created a new addon with following Information:-
Add-on ID: SimpleTextAddon
Title: Simple Text Add On
Version String: 1.0
Version ID: 1
Installation Code: SimpleText_Installer :: install
Uninstallation Code: SimpleText_Installer::uninstall
When I click 'Save Addon', I'm getting an error in overlay that says -
Please correct the following errors:
- Callback SimpleText_Installer::install is invalid (Invalid Class).
- Callback SimpleText_Installer::uninstall is invalid (Invalid Class).
I'm unable to figure out why is the system not accepting my class::method. Can someone tell me what's missing or wrong?