Assignment: Handlebars

In this assignment we will merge our add.php and edit.php into a single form.php which is capable of adding a new entry or editing an existing entry. All of the form rendering will be done with the the Handlebars JavaScript library.

In the sample code, some off the files have been comverted to completely use in-browser rendering for dynamic data, other files use a in-server MVC approach similar to previous assignments, and others are hybrid:

You can play with a sample implementation of the code at:

http://www.wa4e.com/solutions/res-handlebars/

You can download nearly complete implementation of this assignment at:

http://www.wa4e.com/assn/res-handlebars/res-handlbars.zip
The only part that is missing its implementation of profile.php. Without a working profile.php the application's add functionality will work but the editing and view functionality will not work.

To complete the application you must add the profile.php. The profile.php will take a profile_id as a parameter, query the database tables, and return JSON that looks as follows:


http://.../res-handlebars/profile.php?profile_id=11

{
    "profile":
    {
        "profile_id":"11",
        "user_id":"1",
        "first_name":"Charles",
        "last_name":"Severance",
        "email":"[email protected]",
        "headline":"Having a nice day",
        "summary":"A short summary"
    },
    "positions":[
        {
            "position_id":"45",
            "profile_id":"11",
            "rank":"1",
            "year":"2525",
            "description":"Still being alive"
        }
    ],
    "schools":[
        {
            "year":"1209",
            "name":"University of Cambridge"
        }
    ]
}

What To Hand In

As a reminder, your code must meet all the specifications (including the general specifications) above. Just having good screen shots is not enough - we will look at your code to see if you made coding errors. For this assignment you will hand in:

  1. A screen shot (including the URL) of your form.php showing editing an existing entry showing the retrieval of the JSON to populate the form.
  2. A screen shot (including the URL) of your profile.php showing the retrieved JSON.
  3. Source code of profile.php

General Specifications

Note: These are unchanged from the previous assignments. Here are some general specifications for this assignment:

Provided by: www.wa4e.com

Copyright Creative Commons Attribution 3.0 - Charles R. Severance