Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
plugin_development [2016/12/05 21:26] textstorm |
plugin_development [2016/12/05 21:33] (current) textstorm |
||
---|---|---|---|
Line 4: | Line 4: | ||
If you are developing a plugin, please start with the following structure to ensure compatibility. | If you are developing a plugin, please start with the following structure to ensure compatibility. | ||
- | Create a new PHP file - YourPlugin.php - and insert the following code: | + | Download the PHP file, rename it, and put your code beneath the foreach block! Be sure to change the plugin installation SQL too! |
+ | <file php PluginStructure.php> | ||
<?php | <?php | ||
- | |||
/* Block used for the SQL for plugin installation !!!!!!!! IT IS IMPORTANT THE INSERT STATEMENT IS ON LINE 3 FOR THE PLUGIN INSTALLER TO WORK!!! MODIFY THE BELOW TO YOUR DEFAULT VALUES!!! | /* Block used for the SQL for plugin installation !!!!!!!! IT IS IMPORTANT THE INSERT STATEMENT IS ON LINE 3 FOR THE PLUGIN INSTALLER TO WORK!!! MODIFY THE BELOW TO YOUR DEFAULT VALUES!!! | ||
- | |||
INSERT INTO menu (file, activated, function, pagename, menuname, position, heading) VALUES ('plugins/blackjack.php', '1', 'BlackJack', 'BlackJack', 'BlackJack', '8', 'Financial') | INSERT INTO menu (file, activated, function, pagename, menuname, position, heading) VALUES ('plugins/blackjack.php', '1', 'BlackJack', 'BlackJack', 'BlackJack', '8', 'Financial') | ||
- | |||
*/ | */ | ||
//$db = database object, $user = user class to access functions - $user->ModCoins(); | //$db = database object, $user = user class to access functions - $user->ModCoins(); | ||
- | + | function YourFunctionName($db, $user) { | |
- | function **YourFunctionName**($db, $user) { | + | |
//This simple block below means users can modify your plugin, rather than using a specific term such as "Pirate" | //This simple block below means users can modify your plugin, rather than using a specific term such as "Pirate" | ||
- | | ||
//You can use $subtitle1 instead so the user can change it to what they would like in the Plugin Administration | //You can use $subtitle1 instead so the user can change it to what they would like in the Plugin Administration | ||
- | | ||
$pluginused = $_GET["page"]; | $pluginused = $_GET["page"]; | ||
- | | ||
$getcustinfo = $db->query("SELECT * FROM menu WHERE pagename = '$pluginused'"); | $getcustinfo = $db->query("SELECT * FROM menu WHERE pagename = '$pluginused'"); | ||
- | | ||
foreach($getcustinfo as $row) { | foreach($getcustinfo as $row) { | ||
- | | ||
$pagetitle = $row["ptitle"]; | $pagetitle = $row["ptitle"]; | ||
- | | ||
$subtitle1 = $row["subtitle1"]; | $subtitle1 = $row["subtitle1"]; | ||
- | | ||
$subtitle2 = $row["subtitle2"]; | $subtitle2 = $row["subtitle2"]; | ||
- | | ||
$custatt1 = $row["custatt1"]; | $custatt1 = $row["custatt1"]; | ||
- | | ||
$custatt2 = $row["custatt2"]; | $custatt2 = $row["custatt2"]; | ||
} | } | ||
} | } | ||
- | |||
?> | ?> | ||
+ | </file> |