suprie donk bikin blog

November 6, 2007

Symfony Apps Part II

Filed under: PHP — Tags: , , — suprie1983 @ 4:10 pm

Yesterday we have try to build a simple application based on symfony, now we’ll try to make those apps more usable what we have left now is user management
the sequence if users want to make a movie reviews is

  1. user login to the apps
  2. user pick which movie he / she want to review
  3. he / she put some review on it
  4. he can see the reviews.

in the previous sample, we’ve only build the CRUD application, which base of almost every application. To make it simple, we will use a plugin for symfony called sfGuardPlugin. It’s a plugin to ease the pain of user management and save a lot of our time.

first of all you’ve to download the plugin sfGuardPlugin
and follow the instruction found in http://trac.symfony-project.com/attachment/wiki/sfGuardPlugin/

if you succeeded installed the plugin, you should see the login screen when you trying to access your module.

but the page is a plain one, let’s try to change it a little bit first of all you have to create a folder called sfGuardAuth in your module folder, the module folder it self is on the apps/samples

inside of the sfGuardAuth, create a new folder named templates. Now fire up your favorite editor and create a new PHP file, we have to name it signinSuccess.php and secureSuccess.php
let’s create it like this


<?php echo form_error('username'); echo " "; echo label_for('username', __('username:')); echo ""; echo input_tag('username', $sf_data->get('sf_params')->get('username')); echo " "; ?>
<?php echo form_error('password'); echo " "; echo label_for('password', __('password:')); echo ""; echo input_password_tag('password'); echo " "; ?>
<?php echo submit_tag(__('Sign in')); echo ""; echo link_to(__('Forgot your password?'), '@sf_guard_password', array('id' => 'sf_guard_auth_forgot_password')) ?>

that’s for the login page, now what we want is user pick the movie and then give their review of the movie.

(more…)

Blog at WordPress.com.