In the interest of doing something a little different, I’ve decided to do a large post that covers two days instead of doing two separate posts. I’m sure the zero people who read this are thrilled beyond compare about this wild turn of events. Yep.
So this week I continued my journey into the depths of admins land. On Tuesday I had a dentist appointment early in the morning, so my trek that day actually started at about 11:30 am. But start it did. I actually accomplished much this day. During the end of last week, I was having some trouble with getting the status information from the second database to appear on the admins page. I decided to take a break and start work on the other pages needed. These included a create page, an edit page and getting the status to register whether the it’s active or not. All this and creating and editing things to the database itself.
By the end of the day, I had the basics of all the pages done. On Thursday, I started tackling the real heart of it all. I began by finally getting the status column to appear on the admins page. The fix for this was just creating a status field in the main database. I wasn’t having any luck properly accessing the one in the second database. Visualize it now:
This is how the admins page for the glossary appears now:
Here is the offending code that’s brought to you by me:
After this “milestone”, I worked functions that would allow users to create information to go in the main database. A user would choose a category for the information to go under, write a term into a form box, write a definition into another form box, and then choose whether all this info needs to be active or not. This would then be written into the database for future use by anybody who is crazy enough to care.
This is what the page looks like. Marvel at the wonderfulness:
Make it active!:
After the information is filled out, the user clicks the submit button. After which, a message is printed to the admins glossary page letting the user know that their amazing insight is collected.
Rest assured, you’ve done well:
And there it is on the page. Isn’t life grand?:
And finally, a little look at the database to stroke my own ego.
Who would have thought that Wonkal meant that:
Here is the code that has been created for this outstanding achievement:
The view for the glossary admins page:
Now, the following code also is for the edit function.
This is the Model page that has functions addEntry for creating information. It also has the edit function updateEntry:
And now let’s bring in the Controller! This has functions for create, delete and edit:
And last, but not least, this is the view for the edit page. This brings up whatever Term/Definition that you clicked the edit link for. It has all the information for the user to edit (including Category in case it was entered wrong and the status).
The View from a mile up:
And the code to accompany it:
As you can see, I’ve been rather busy for the past week. The last thing that I’ve got to do (besides getting the main view finished) is get the creation mode to insert the proper cat_id into the Glossary table. I’m pretty excited about it all. I spent so much time fuckin’ around with the main view that I got discouraged. To make this much progress in a week makes me feel better about what’s to come. Bring on the next quarter. I’ll do my best.