home | list info | list archive | date index | thread index

Re: [OCLUG-Tech] web tools for a roster

Paul:

Your application sounds pretty trivial - all the major components are already in place. If the tables are already defined, creating a user-maintenance portal isn't much more work. I do this kind of user app in a couple hours - so anyone should be able to do it. I think to a great degree you are overthinking tools and frameworks - just get dirty and start with native PHP, adding one field at a time to a maintenance page. The biggest impediment to getting a project done is actually sitting down and starting.

If you want, I could provide some source code to a sample table maintenance page.

I generally parse out application functions to separate "includes" which are loaded as needed on page load - based on the state of any POST variables. This allows a simple framework where the same base page is visually and functionally different based on where you are in the process.

Before you worry about HOW you do things it is better to think through WHAT you want to do:

PHP (actually all web apps) have one major thing you've got to figure out - and that is how to pass/maintain critical information you need in between changes in application state (submit/button clicks, reloads, refreshs). I personally HATE depending on Javascript for anything, so understanding how $_SESSION, $_POST and $_GET handle things is the biggest challenge. You have to specifically know how you want critical data maintained when a user clicks "Next", "Add", "Update", "Delete", and how you expect to "catch" it when the next web request is received by the web server (because your web server has no clue the new request has anything to do with a page it served five minutes ago).

Break your functional requirements into "include" fragments, both visual (HTML) and code. This also helps gain benefits of developing little "objects" that you can trust to work without having to debug huge procedural blobs of code.

You pick which include(s) are presented by the state of the $_POST['submit'] (or whatever) - so one URL can present many different functions.

This also keep the code clean and separates HTML presentation from code. Use whatever style sheets the application already has, therefore style doesn't need to be coded manually.

From long experience, figuring out someone else's tools can take WAAY longer than just getting your hands dirty and doing it yourself. Everybody abstracts tasks differently, so getting my head around someone else's methods hurts my brain.

Since you've coded in other languages, this should be a walk in the park. The simplicity of how PHP handles variables and cleanup makes life easy. Take a hard look at mysql_fetch_array(), extract() - the combination is deadly and reduces most simple coding from dozens of lines to one or two.

The following snippet may help a lot while trying to figure out what your page is doing if pasted at the top of the PHP code:

  if ($_GET['debug'] === 'true') {
    print "
    SESSION:<br>
<pre>
    \n";
    print_r($_SESSION);
    print "
</pre>
<br>
    POST:<br>
<pre>
    \n";
    print_r($_POST);
    print "
</pre>
<br>
    GET:<br>
<pre>
    \n";
    print_r($_GET);
    print "
</pre>\n";
  }

If you load "http://www.yourserver.org/test_page.php?debug=true";, you will see all the stuff passed to your page by the server. This can really help you figure out how web applications work. Same thing works on the command line version fo PHP in a terminal window.

Hope this helps a little and de-mystifies web application development.

--
Bill Strosberg

On 12-03-21 10:16 AM, Paul Hays wrote:
I'm looking for suggestions about tools for making a small web app.

It's for an all-volunteer association that has a website on a Linux
virtual server (with Apache httpd, PHP and MySQL). Our webmaster is
starting a makeover. He wants a new page that will let association
members update their own entries in the membership roster.**

This may be an opportunity for me to learn how it's done these days.

-- What's the right toolset?
-- Is something like Zend, Yii or CakePHP appropriate, or just
lower-level PHP? (A link to a recent tutorial that builds something
similar would be ideal.)
-- Care to guess a number of hours to learn enough of it to complete
this? (I've written low-level C and C++ code, some Xerces and MySQL, a
little QT and Python, but no PHP or any web technology more complex than
static html.)

Any comments on these?
    http://www.magentoecommerce.com
    http://ca.php.net/mysqli

http://sheriframadan.com/2010/10/creating-a-member-system-using-object-oriented-programming/
    http://edrupler.com/content/php-101-part-1-down-rabbit-hole

- Paul Hays


-----------

**  Requirements so far (more always appear!):
   -- administrators get passwords and full access (except reading passwords)
   -- administrator can add, update, or delete any member's data
   -- each association member makes a password permitting limited access
   -- a member can update the member's own data (other than id)
   -- any member can export and download the roster as a csv file
   -- reasonable security (e.g. input validations, one-way encrypted
passwords)

There are only a couple of hundred association members; locking can be
very gross.

These may be overkill...
    http://www.oxwall.org/
    http://civicrm.org/features/members


references