wrux Posted May 1, 2014 Share Posted May 1, 2014 I've had a go at creating an app for mccodes and it's just a simple investment bank but I guess it's a start. I know it's not very imaginative, but I guess it's better than nothing. First off, i'm not sure what kind of APIs people have created, but I wrote a super simple flash message class just incase people don't have one already. [ATTACH=CONFIG]1398[/ATTACH][ATTACH=CONFIG]1399[/ATTACH][ATTACH=CONFIG]1400[/ATTACH][ATTACH=CONFIG]1401[/ATTACH] Ok so first of all, this requires at least PHP 5.3 and it requires you to change the DB engine for the users table, nothing to bad, it may cause some problems if you don't do this. So heres the SQL to run: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. If you wish to use the flash message class then add this somewhere in global_func.php. It's nothing complex (DRY and all that jazz though?) and i'm sure the use of __toString() is incorrect, but it's just a shortcut. You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Then if you open up globals.php; right AFTER require "global_func.php"; add this line: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Somewhere in your template, you'd now want to display the messages so add this section: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. And finally, heres the investmentbank.php code you need to add: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. One thing to note is the lack of ORM and if somebody has written a decent ORM for mccodes then i'd be happy to update my code, but for now I just used super old code which works, but it's not ideal. Quote Link to comment Share on other sites More sharing options...
Guest Posted May 1, 2014 Share Posted May 1, 2014 You half use MCC and half not, you may want to look into the database class a little more, work a little on those nested ifs, but other than nice nice to see some OO stuff Quote Link to comment Share on other sites More sharing options...
wrux Posted May 1, 2014 Author Share Posted May 1, 2014 You half use MCC and half not, you may want to look into the database class a little more, work a little on those nested ifs, but other than nice nice to see some OO stuff Yea I looked at the DB API but it sucked so I just used the mysql commands directly which is kinda bad but I guess I could update it Quote Link to comment Share on other sites More sharing options...
Guest Posted May 1, 2014 Share Posted May 1, 2014 Yea I looked at the DB API but it sucked so I just used the mysql commands directly which is kinda bad but I guess I could update it Mysql_* is the worst, whether it sucks or not, using native methods is so much easier in the long run, mysql_* is also depreciated. Personal preference but I am totally against those if statements if : endif: it just looks horrible imo Quote Link to comment Share on other sites More sharing options...
wrux Posted May 1, 2014 Author Share Posted May 1, 2014 Mysql_* is the worst, whether it sucks or not, using native methods is so much easier in the long run, mysql_* is also depreciated. Personal preference but I am totally against those if statements if : endif: it just looks horrible imo Ahh, the alternative syntax is just more human readable so good for the template section Quote Link to comment Share on other sites More sharing options...
wrux Posted May 1, 2014 Author Share Posted May 1, 2014 Ahh, the alternative syntax is just more human readable so good for the template section I have just updated my local code so that the database calls now use the procedural mysqli class. The only issue is that this requires an additional DB connection as not all of the website uses this. I'll post it anyway: In your globals you'd need to setup a MySQLi object called $mysqli first. You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted May 1, 2014 Share Posted May 1, 2014 No matter what you think of the default mysql*_ class you should still use it just to be consistent with the engine. Some people dont know how to create class objects, methods, etc. The more "talented" people can rip your stuff apart and use their own way of db communications. So for the people that like to keep everything consistent I went ahead and converted it for ya: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Or for the people that really want to use this the way it is: Add to globals.php/globals_nonauth.php You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Quote Link to comment Share on other sites More sharing options...
wrux Posted May 1, 2014 Author Share Posted May 1, 2014 No matter what you think of the default mysql*_ class you should still use it just to be consistent with the engine. Some people dont know how to create class objects, methods, etc. The more "talented" people can rip your stuff apart and use their own way of db communications. So for the people that like to keep everything consistent I went ahead and converted it for ya: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Or for the people that really want to use this the way it is: Add to globals.php/globals_nonauth.php You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Ha cheers dude. I've noticed the massive difference with people's code on here, like how you changed the curly brackets. That's one reason I think i'll stick to python, no arguments over code indentation and brackets lol. Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted May 1, 2014 Share Posted May 1, 2014 Ohh sorry about that. That was just my netbeans reformatting :p Quote Link to comment Share on other sites More sharing options...
wrux Posted May 2, 2014 Author Share Posted May 2, 2014 Just realised theres an error in the code I posted. I think I must have clicked somewhere when I was posting this... This line: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Needs to be replaced with this: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. And that should now create a timedelta of the number of days. Whoops :/ Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted May 2, 2014 Share Posted May 2, 2014 Just so people are aware or maybe it's my phone but there is in fact an underscore "_" in the $end_date var or "end date" as it looks to me Never Mind The line it's sitting in for the bbcode parser is just a tad bit thin height wise :o Quote Link to comment Share on other sites More sharing options...
wrux Posted May 2, 2014 Author Share Posted May 2, 2014 Just so people are aware or maybe it's my phone but there is in fact an underscore "_" in the $end_date var or "end date" as it looks to me Never Mind The line it's sitting in for the bbcode parser is just a tad bit thin height wise :o Ahh ok, I just checked and it looks okay on desktop :cool: Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted May 2, 2014 Share Posted May 2, 2014 [ATTACH=CONFIG]1407[/ATTACH] Just to to show I'm not going insane haha Quote Link to comment Share on other sites More sharing options...
wrux Posted May 2, 2014 Author Share Posted May 2, 2014 [ATTACH=CONFIG]1407[/ATTACH] Just to to show I'm not going insane haha haaha, yea it does look a bit dodgy Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.