Sms Biography
Source(google.com.pk)
I've been working on a sim for a while now that will focus largely on xeno and astrobiology. Because of this I'm trying to create a page in SMS that will have (generally) the same format as the biography page. For example, the specie
s page will have the following fields:
Name:
World/Star of Origin: (Drop-down selection populated by existing location entries)
First Contact Achieved: Y/N
Appearance:
Psychological Profile:
History:
Similarly I would like a page that does the same for interstellar bodies (ie - Stars, Planets, Moons, etc) with the following fields:
Name:
Location(sector, system, etc):
Major Features:
Inhabitants: (Drop-down selection populated by existing species entries--five slots)
Population:
Notes:
Because I want drop-down selection boxes, I would also like the field-when viewed by a non-power user-to provide links to the species/location indicated in the section. This would also come with management pages, so there would be the necessity of yet more page modification, although I am not sure how much for that aspect of these pages.
Now, on to what I think would be required. If I understand SMS correctly, I would need to create a new table/value holders for the SMS database so that all relevant information can be effectively stored. There would need to be at least two separate pages created, probably titled species.php and location.php that access the values and can be accessed through (hopefully) admin and data retrieval functions stored within those pages.
Because I'm not great with database programming, or php in general, I would love some help if anyone would like to offer a hand, of just a place to start and give me some useful instructions on where to go next. Thanks. I hope I can get this worked out. :)
-Brent
Brent Litster
Top
POSTS: 98
AgentPhoenix Thu Sep 03, 2009 9:31 am
Re: New SMS Pages Based on Biography Format
First of all, welcome back, Brent. :wink:
Next, while I don't have time to help you with this, I can certainly point you in the right direction. You're correct that building something like this is a major endeavor. Most people want to do something that modifies an existing table or maybe adds one new table, but you're talking about two new tables. Congrats on taking modifications to a whole new level. :P
Let's start with species. Your best bet is to create a table called sms_species and put fields in there for all the information you want. Likely, you'd need species_id (INT), world (VARCHAR), first_contact (ENUM - y/n), appearance (TEXT), psychological (TEXT), and history (TEXT). Once you have those, you can start the rest of the process.
Your best bet is to start with the administration page. Yes, it's the most difficult part of the process, but better to start with the tough stuff and get it out of the way. The best place to put that is probably in admin/manage/species.php. You'll probably want to copy a page like the database management page to start. Then, you can start building your queries to pull information. The first and most crucial step is being able to create data. If you can create it (and you've managed to build out the rest of the page), once you've successfully created the page, you'll start to see a list of species. Once you have a list of species, then you can turn your attention to editing that species (again, the database management page is going to be your friend here). Once you can create, update and delete, you have 3 of the 4 things you need. The final piece is retrieval which you already have part of because you retrieve what's there to populate a list.
Again, using the database as a template, duplicate the pages/database.php page and start to tweak that to pull from the proper table and use the proper values. Before you know it, you'll have a full-fledged species page and then it'll be old hat for doing the planets stuff. If you have questions, just post them in this thread and I'll do my best to point you in the right direction (just make sure that whatever you're working on is accessible so I can see any issues).
Good luck!
Image
Top
User avatar
POSTS: 7075
borg0861 Thu Sep 03, 2009 10:45 am
Re: New SMS Pages Based on Biography Format
Hey, thanks for the welcome. I've been swamped lately, but I got a new job with a lot of down time, so I can start doing some work on my favorite hobby again.
So I'm taking notes and working on what I can. I don't have immediate access to my DB, but I'm confident I can get the appropriate tables and fields created here soon. In the meantime, I've been taking a look at the admin/manage/database.php --which I have copied to create species.php-- and I'm in a bit over my head. I recognize a lot of what everything does, but I'm just not sure what I can cut out and where I need to splice things to make it work right.
For example, I don't need the departmental breakup on the management page. So I'll need to eliminate the differentiation in the actual display, but also cut out the departmental access checks. I don't really know where to start. I'm also not sure which values I want to change. I know I'll want to rename dbTitle something like speciesTitle or something, but I'm not sure where to put everything. That being the case, I'll create another post on this thread in which I'll break the code into the sections I understand, and as all you PHP gurus have time, you can help me understand it all.
Thanks in advance!
Brent Litster
Top
POSTS: 98
borg0861 Thu Sep 03, 2009 11:23 am
Re: New SMS Pages Based on Biography Format
Okay, here goes:
CODE: SELECT ALL
/**
Thissa necessary system file. Do not modify this page unless you are highly
knowledgeable as to the structure of the system. Modification of this file may
cause SMS to no longer function.
Author: Brent Litster [ borg0861@gmail.com ]
File: admin/manage/species.php
Purpose: Page that moderates the database entries
System Version: 2.6.9
Last Modified: 2009-09-05 MDT
**/
/* access check */
if( in_array( "m_database1", $sessionAccess ) || in_array( "m_database2", $sessionAccess ) ) {
/* set the page class and vars */
$pageClass = "admin";
$subMenuClass = "manage";
$query = FALSE;
$result = FALSE;
$action_type = FALSE;
$myDept = FALSE;
if(isset($_POST))
{
/* define the POST variables */
foreach($_POST as $key => $value)
{
$$key = $value;
}
/* protecting against SQL injection */
if(isset($action_id) && !is_numeric($action_id))
{
$action_id = FALSE;
exit();
}
switch($action_type)
{
case 'create':
$create = "INSERT INTO sms_database (dbTitle, dbType, dbDesc, dbOrder, dbDisplay, dbURL, dbContent, dbDept) ";
$create.= "VALUES (%s, %s, %s, %d, %s, %s, %s, %d)";
$query = sprintf(
$create,
escape_string($_POST['dbTitle']),
escape_string($_POST['dbType']),
escape_string($_POST['dbDesc']),
escape_string($_POST['dbOrder']),
escape_string($_POST['dbDisplay']),
escape_string($_POST['dbURL']),
escape_string($_POST['dbContent']),
escape_string($_POST['dbDept'])
);
$result = mysql_query( $query );
break;
case 'update':
$update = "UPDATE sms_database SET dbTitle = %s, dbOrder = %d, dbDisplay = %s, dbURL = %s, dbDesc = %s, dbContent = %s, ";
$update.= "dbType = %s, dbDept = %d WHERE dbid = $action_id LIMIT 1";
$query = sprintf(
$update,
escape_string($_POST['dbTitle']),
escape_string($_POST['dbOrder']),
escape_string($_POST['dbDisplay']),
escape_string($_POST['dbURL']),
escape_string($_POST['dbDesc']),
escape_string($_POST['dbContent']),
escape_string($_POST['dbType']),
escape_string($_POST['dbDept'])
);
$result = mysql_query( $query );
break;
case 'delete':
$query = "DELETE FROM sms_database WHERE dbid = $action_id LIMIT 1";
$result = mysql_query($query);
break;
}
/* optimize the table */
optimizeSQLTable( "sms_database" );
}
Okay, here's what I'm getting from this. This section is the foundation of the page. It basically defines how the system writes its information into the database, and what is not written to the database. In this section, I would need to change values like: sms_database, dbTitle, dbOrder, etc to my new table and field titles.
S.M.S., SO MUCH SWAG, SCRIPT, MAC & SPEED WHATEVER YOU WANT TO CALL THIS TRIO, THEY ARE WITHOUT A DOUBT ONE OF HIP-HOPS UP & COMING GROUPS TO BE RECKONED WITH. FORMERLY ALL SOLO ARTISTS, THE GROUP LINKED UP IN THE SPRING OF 2008 COURTESY OF MARIO “ BIG HOMEY” McCOY WHO FELT LIKE THE COMBINATION OF SCRIPTS’ LYRICS MIXED WITH MACS’ MELODIES & SPEEDS’ ENERGY TO RIDE THE HELL OUT OF THE BEAT, THERES NO WAY THIS YOUNG TRIO WOULDN’T BE ABLE TO SEE BEYOND THE CITY STREETS OF MILWAUKEE, WI. EACH BEING PRODUCTS OF THE N.D.C. (NO DADDY CLUB), GROWING UP IN SINGLE PARENT HOMES, WITH NOTHING MUCH TO DO BESIDES RUN THE STREETS, MUSIC WAS AN ESCAPE FOR THEM ALL. SCRIPT, THE OLDEST MEMBER OF THE GROUP IS MORE LAID BACK, EAST COAST SWAGGER TYPE OF DUDE. HE ISA DIE HARD FAN OF ARTISTS SUCH AS JAY-Z AND NAS. LYRICS ARE A MUST IN HIS OPINION. SPEED, THE SECOND OLDEST MEMBER OF THE GROUP IS PART OF THE HIP-ROCK ERA. THE SKULL HEADS, WALLET CHAINS AND FANCY SHADES, YOU CATCH MY DRIFT. HIS INFLUENCES CONSIST OF ARTISTS SUCH AS LIL WAYNE, PLIES, & RICK ROSS. RIDING THE BEAT IS AN UNDERSTATEMENT COMPARED TO HOW THIS DUDE JUMPS ON THE TRACK. TO COMPLETE THE GROUP WE HAVE THE YOUNGEST ARTIST OF THE THREE WHO GOES BY THE NAME MONEY MAC. MAC IS THE MOST EMOTIONAL & OUTSPOKEN OF THE GROUP. FORMER BATTLE RAP KING, IT WOULDN’T BE SMART TO DISS HIM ON WAX. INSPIRED BY ARTISTS SUCH AS THE LATE 2PAC SHAKUR, BIGGIE SMALLS AND THE KING OF THE SOUTH, T.I.P., MAC HAS WENT FROM BATTLE RAPPER TO SONGWRITER. IM SURE YOU WOULDN’T BELIEVE THAT THIS DUDE CAN’T EVEN BUY LIQUOR YET. BEING CONTENT WITH STARDOM IN THE CITY OF MILWAUKEE IS FAR FROM WHAT THIS TRIO IS LOOKING TO ACCOMPLISH. CURRENTLY WORKING ON THEIR FIRST DEBUT ALBUM ENTITLED “NEW ERA”, S.M.S. PLANS ON CHANGING THE GAME WITH AN ALBUM FULL OF VERSATILITY, NO FEATURES! FROM SINGING HOOKS TO ROCK N ROLL JOINTS THEY DO IT ALL. NO FEATURES! SO THERE YOU HAVE IT, I COULD GO ON FOREVER BUT S.M.S. TOLD ME THEY’D RATHER LET THE MUSIC DO THE TALKING. WITH THAT BEING SAID, WELCOME TO A NEW ERA OF HIP-HOP. SCRIPT- JOSH BURKES MONEY MAC- DAVONTE UNDERWOOD SPEED- JOSHUA SPEED
0 commentaires:
Enregistrer un commentaire