logo

Member
Member
Offline Offline
Posts: 6
Some Mod Questions

So I'm making a small mod, started by ripping apart the navi panel mod.

Ran into some things (when making the installer):
1. Any way to specify what gets put into a panel? Like, can I predefine a panel with some links and stuff?
2. When creating tables, it lets the plugin install if you have problems (Like putting "int(225" instead of "int(225)".
3. Anyway to insert data after the tables are created?
eoCMS Developer
eoCMS Developer
Offline Offline
avatar
Posts: 1528
Re: Some Mod Questions

2. Yes i know, the create_sql function does not check to see if there are any errors yet.
3. There was but for some reason I have removed a variable which is set before the inclusion of the plugin-info.php file. I will add it in again. Basically, do a
Code:
if(isset($plugin_install) {
//run whatever code you want to during the install here
}

in the plugin-info file.
Just waiting on TGPEG's energy blue theme before i release 0.9.01 which has lots of bug fixes

Please do not PM me requesting support or anything, use the forums, thats what they are here for
eoCMS Designer
eoCMS Designer
Offline Offline
avatar
Posts: 1290
tbarkass_willamson@hotmail.com
Re: Some Mod Questions

It's nearly done...

Seen a bug? Report it!
Member
Member
Offline Offline
Posts: 6
Re: Some Mod Questions

2. Yes i know, the create_sql function does not check to see if there are any errors yet.
3. There was but for some reason I have removed a variable which is set before the inclusion of the plugin-info.php file. I will add it in again. Basically, do a
Code:
if(isset($plugin_install) {
//run whatever code you want to during the install here
}

in the plugin-info file.
Just waiting on TGPEG's energy blue theme before i release 0.9.01 which has lots of bug fixes

Now that .9.01 is released, is there any other way to do #3? (plus although I'm able to run code during the install, am I allowed to run queries freely across the database? :p bit dangerous if so.)  I'd like an example of how to do this or the docs for the new plugin system finally filled out Wink
eoCMS Developer
eoCMS Developer
Offline Offline
avatar
Posts: 1528
Re: Some Mod Questions

Basically
Code:
if(isset($plugin_install)) {
//run a query for install, insert possibly?
call('sql_query', "INSERT INTO example ('test', 'hi') VALUES ('lol', 1)");
}

In theory yes it is dangerous but that is why people need to only install plugins from the mods db Wink


Scrap what I just said, it doesnt run them properly, as they are ran before the table creations are....

Ok, either download the 0.9.01 again or just overwrite the installplugin.php function file with this http://pastebin.com/f262ab778

Finally got this working correctly. Any code you wish to run during installation PRE table creation then use
Code:
if(isset($plugin_install)) {
//code to run during installation PRE table creation
}


If you wish to run any queries AFTER table creation use the following variable
Code:
$plugin['tables']['extra'] = array("PURE SQL QUERY HERE", "ANOTHER QUERY HERE");

and so on

For the inserting example:
Code:
$plugin['tables']['extra'] = array("INSERT INTO calendar_options (id, option, value) VALUES (0, 'events', 0)",
                           "INSERT INTO calendar_options (id, option, value) VALUES (1, 'birthdays', 0)",
                           "INSERT INTO calendar_options (id, option, value) VALUES (2, 'user_events', 0)",
                           "INSERT INTO calendar_styles (id, name, bgcolor, wbgcolor, color, wcolor, selected, hsize, tsize) VALUES (1, 'Default', 'black', 'white', 'white', 'black', 'red', 50, 25)",
                           "INSERT INTO calendar_options (id, option, value) VALUES ('3', 'style', '1')");
Last Edit: 12th October, 2009, 12:43:40 PM by confuser

Please do not PM me requesting support or anything, use the forums, thats what they are here for

Jump to:


0.09 seconds Queries: 14