Building Admin Pages for Your Site

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
supermike
Forum Contributor
Posts: 193
Joined: Tue Feb 28, 2006 8:30 pm
Location: Somewhere in the Desert, USA

Building Admin Pages for Your Site

Post by supermike »

I've been doing PHP web apps now for awhile for my international clients. However, I'm feeling like I'm still too slow. I'm hung up doing admin interfaces all the time for public websites I bring up for my clients. Has anyone come up with a generic admin framework interface, perhaps with a GUI or without, that is very suitable, easy to learn and customize? For instance, I can't just provide a reference table editor, because there are business rules that must be fired and that could mean multiple reference tables must be edited. As well, admins want to search reference and main task tables by certain criteria, and then I need to provide paginated results.

Let me be more concrete. Let's say I have a webmaster admin system for a Yellow Pages-style directory website for a particular niche market. My client, the webmaster who has no programming skills, wants an admin system for the reference tables and the main task tables. The main task tables would be things like the queue tables for the directory, such as listed items, unlisted items, and a moderation queue for added or edited listings. This is where the meat and potatoes is for the application. As for the reference tables, these are things that are usually smaller tables addressed by foreign keys, such as users, groups, categories, payment methods, and so on. Anyway, the admin system needs to let one add, search/edit, search/remove and/or search/disable, purge disabled items, and do it for each reference table and each main task table, as well as perhaps move records from one table to another (like queue tables).

For now, I'm frustrated because I have to draw the admin menu systems by hand, the admin forms by hand, the search/lookup mechanism by hand, and so on, and although I can cut and paste between some pages, every page seems to need a special customization here or there because of a business rule.

I also didn't want to waste a lot of time on making paginated search for records, so for now I'm using AJAX on about 2-3 main fields for a reference or main task table, and because I could return thousands and thousands upon records, I use a mechanism of a Starts With... field such as "Starts With Aa - Ai" and when that is selected, it only shows me choices for that field which are applicable. Then, I choose one of those choices and the form populates with data for just one record.

It would be great if I could get used to a framework that I simply point to tables, choose certain options about those tables and the style of admin interface, choose generate, and it builds the main admin menu system and all the forms and receiving pages for each admin menu item, along with all working DB code. At that point, I just customize for the extra business rules.

P.S. I hope this is the right forum for this. I figured I needed to discuss something higher level than, let's say, how to fix a broken page, and that this was about theory, not really about actual coding.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: Building Admin Pages for Your Site

Post by alex.barylski »

There are numerous frameworks out there, where have you been? :P

Each one does a certain task a little better or worse than the other. If you want to just allow admins the ability to update tables which are displayed on the client site, then you probably want to look into one of the hundreds of open source CMS available and begin hacking that until it bends in the way you need it.

There are of course classes like HTML_QuickForm2 in PEAR which can be used to generate entire FORM's but each time you automate one task, you generally loose control over something. It's a give and take relationship, and each developer has his or her own balance of speed over flexibility, so your question is likely impossible to answer completely.

It's this difference of opinion which has liekly lead to the plethora of existing generic frameworks, application frameworks, etc.

If I am to understand you correctly, you wish to allow admins to edit tabular data on the backend and that table is generated on the front end? Something like phpMyAdmin does with SQL but with custom business rules to ensure data integrity???
supermike
Forum Contributor
Posts: 193
Joined: Tue Feb 28, 2006 8:30 pm
Location: Somewhere in the Desert, USA

Re: Building Admin Pages for Your Site

Post by supermike »

On your question -- exactly.

You know, as I finished writing that, I came to realization that no matter what framework I get, it just won't feel like it will follow my tastes, so I might as well build one, myself. That way, the learning curve is already accomplished and I know where everything is in the thing so that I can customize it.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: Building Admin Pages for Your Site

Post by alex.barylski »

supermike wrote:On your question -- exactly.

You know, as I finished writing that, I came to realization that no matter what framework I get, it just won't feel like it will follow my tastes, so I might as well build one, myself. That way, the learning curve is already accomplished and I know where everything is in the thing so that I can customize it.
(un)fortunately...that is common opinion of most developers...it's both a good thing and a bad.

One one hand, you learn as you go and custom tailor exactly to fit your needs, requiresments and personal taste -- it's a fun excersize. On the downside, you spend a tremendous amount of time re-inventing the wheel.

Some people try and have their cake and eat it too by building a framework from existing libraries or frameworks -- common topic around these parts. Personally the only library I use which is external to my own is SwiftMailer -- only because the thought of developing my own makes me cringe. :P

Cheers :)
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: Building Admin Pages for Your Site

Post by Kieran Huggins »

maybe instead of having a completely automated admin module you could look into generating a scaffold. You generate it once, then modify it to suit your business req's. Sounds like that would take most of the pain out.

It would work well in simple situations, but I imagine that would cover most of your use cases.
armandopadilla
Forum Newbie
Posts: 1
Joined: Sat Mar 01, 2008 12:49 pm

Re: Building Admin Pages for Your Site

Post by armandopadilla »

Have you tried looking into cakePHP. they have a scaffolding option that lets you do much of what you are asking for. Of course you still have to add in your own business rules :-)
supermike
Forum Contributor
Posts: 193
Joined: Tue Feb 28, 2006 8:30 pm
Location: Somewhere in the Desert, USA

Re: Building Admin Pages for Your Site

Post by supermike »

Kieran Huggins wrote:...look into generating a scaffold...
Okay, I must be in some kind of PHP dark ages. I mean, I'm using Smarty, and I do PHP class OOP stuff, but what is this new term scaffold that I hear so much about these days?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Building Admin Pages for Your Site

Post by Christopher »

Typically is is some kind of build-time tool that will generate code for a common situation, such as CRUD, given some information about the database, fields, etc..
(#10850)
Post Reply