Runn is like MCCv2 but less ugly and actually OO. That's all...
Over the next few weeks I will occasionally provide examples of the functionality of the and address issues MCC had which Runn will address.
Example 1: The user's information
MCC functions around globals.php which pulls functions and database queries. This is more often used to call the user's information, such as their id, username, money, etc. This method of calling the user's information can be very useful, however, issues do occur from this methodology:
Irrelevant information for the current script/Unnecessary amount of database queries
The information will more than often be static
The script itself may not require any user information
One primitive example of this is the user's information on the left panel of MCC. To resolve this issue we can take advantage of sessions. Firstly, if we successfully authenticate a user's information before proceeding to login we can create a $_SESSION element and set it to be true.
$_SESSION['user_update'] = 1;
This array element is important as the information will be assessed by an if statement.
if ($_SESSION['user_update'])
{
$_SESSION['user'] = User_get_info(
'user_id',
'user_display_name',
'user_money',
'user_crystal',
'user_level',
'user_will',
'user_energy',
'user_health',
'user_brave', $_SESSION['user_id']
);
$_SESSION['user_update'] = 0;
}
Now a developer can simply use the already provided information without needing to hit the database.
Runn runs its own globals file and will check the state of the session. Though we have to remember to include update the session's when we change the (relevant) information about the user we've simplified the process and save ourself time debugging as we're only using one function and one file, rather than numerous files and functions.
This was brief example of what Runn will be capable of.