![]() |
| Home Community Mys-Script Creative Off-Topic |
|
|||||||
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Well I got some work done re-factoring the code. I've made the timestamps down to the hour:min:sec, created a table just for bonus data, and made it an independent function/method.
- New instructions (so far) are as follows: Open phpMyAdmin to access your MySQL database. Open up the database for Mysidia. On the left hand side there should be a long list of tables for Mysidia, with the prefix that you put in during your initial install. The default prefix is adopts_. If your prefix is different, you will want to change it in two places in the code below. Now, look to right side, at the top. The second tab, between Structure and Search, should be SQL. Open this up, and paste in the following code to run, then press "Go". Code:
CREATE TABLE IF NOT EXISTS `adopts_kyt_bonuses` ( `id` int(10) unsigned NOT NULL, `bonus_name` varchar(20) NOT NULL, `bonus_type` varchar(20) NOT NULL, `status` varchar(5) NOT NULL, `amount` varchar(20) NOT NULL, `timestamp` varchar(20) NOT NULL, `expiration` varchar(20) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `adopts_kyt_bonuses` (`id`, `bonus_name`, `bonus_type`, `status`, `amount`, `timestamp`, `expiration`) VALUES (1, 'Bonus1', 'Type1', 'off', '2', '2014-11-17 16:33:07', '2014-11-18 17:06:41'); INSERT INTO `adopts_kyt_bonuses` (`id`, `bonus_name`, `bonus_type`, `status`, `amount`, `timestamp`, `expiration`) VALUES (2, 'Bonus2', 'Type2', 'off', '6', '2014-11-17 21:49:59', '2014-11-18 22:23:33') You will now be able to find the table we created, adopts_kyt_bonuses, in the list on the left. If you open it up, you should see a table that looks like this: ![]() *Disclaimer: Sometimes I'll be calling things functions, other times I'll be referring to things as methods. However, methods are just functions found inside a class. *thumbs up* Onward! Open up ~/classes/class_template.php. We're going to be creating a new method called checkCommunityBonuses(). To start, we'll add it to the method used to construct the template, that way it knows to run. If you haven't modified this file, in version 1.3.4, you'll find public function __construct(Path $path) at around line 62. Inside this method that constructs the template, after the list of other functions it knows it needs to run, add in: PHP Code:
PHP Code:
Assuming IntoRain's modification to levelup.php mentioned in a post above works out just fine (replacing of course the line linking to the effect in the database), we'll be doing something similar to that. Exact instructions for this part aren't written up yet, aha. - Things I need help with now: 1 - You'll see that in the construct method for the template I'm calling the checkCommunityBonuses() function I made with a parameter holding the bonus name. Obviously not ideal at this point! I need to make another function that pulls from the database the number of bonuses that exist, loop through them, and then call checkCommunityBonuses() for each of them. ( And it's much too late tonight for my brain to want to do that.)2 - H-how do I make Smarty variables with a variable in the name? *nervous laugh* I left the code in there from last time (give or take a few tweaks) but it'll only pull up data from the last bonus it came across, I'm sure. I want to make an admin panel here, so telling users they have to go in and make these variables by hand is... not ideal. Obviously, they'll want to be able to customize the contents of these -- rather than reading off hard data they could put in an image and a tooltip to represent the bonus being on or off.3 - So. New settings to add the AdminCP... Man, would I appreciate some pointers here. I'll figure it out later given enough time, but I don't have any specific questions right now because I haven't even begun to peer down that rabbit hole. This is on my to-do list... ![]() 4 - The modifications to levelup.php - so, what if we've got multiple bonuses going on? And, what if I create room in the database for the bonus clicks and currency so users can do that in the adminCP? I don't know how many bonuses a site owner might create, but I would know their settings for bonus clicks and currency, then. 5 - Eh, should I just forgo the adminCP business, since there's going to be so much to do by hand, anyway?
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it. |
|
#2
|
||||
|
||||
|
Sorry, I've been busy lately and couldn't reply earlier x.x
When creating a table, you can set your ID to be a primary key and auto_increment. That way you don't need to add an id manually when inserting a new row, it will increment the ID's for you Quote:
So, basically you can call your function like this: PHP Code:
PHP Code:
Quote:
assigning: PHP Code:
PHP Code:
Quote:
I can be more specific when you go into making the admincp pages ^^ Quote:
I advise just finishing the feature itself and worrying about the admincp after you have everything finished. As long as the values are in the database, it should be simple to find a way to change them ^^
__________________
![]() ![]() ![]() asp.net stole my soul. |
![]() |
| Tags |
| bonus, clicks, community, interaction, mod |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| The community here is brilliant! | CallumCharlton | Newcomer Center | 3 | 03-11-2015 11:29 AM |
| Opinions on Progress | RoconzaArt | Art Gallery | 9 | 01-20-2011 11:38 PM |
| Which is best open source community software? | chriskrich878 | Other Chat | 3 | 11-23-2010 10:06 PM |
| Still a work in Progress | MyBBSkinz | Adoptables Sites Showcase | 7 | 08-31-2008 09:13 AM |
| Urm Yeah mybb community forums | Ajof | Other Chat | 5 | 06-29-2008 05:12 PM |
What's New? |
What's Hot? |
What's Popular? |