Nature and Aims of the CakePHP Application

http://pict.uws.ac.uk/~sss04/cakephp/

The aim of the following blog is to show my development through the module “Server Side Systems”. This blog is focused on my CakePHP development work.

My CakePHP application is based on existing project. During next few weeks I will be fixing and extending the given CakePHP USCMS.

The purpose of the Football Stars Cake PHP application is to gather information about football players. Every logged-in application user can add new football players. One single post describes one football player.

The initial core functions that will be included are:
• Authentication and permissions for posts, comments and users,
• User registration and log-in,
• User roles with an admin role, so the admin can edit other users,
• Item editing for admins only,
• Utilizing ENUM for drop downs,
• Styling and layout,
• Data Sanatization,
• Pagination,
• Data Validation.

Database Structure & Possible Roles

a -admin

u –authenticated users

v -non-authenticated visitors

C R U D
Posts a u a u v a u a u
Comments a u a u v a u a u
Users a u a u a u a
    Posts table:

  • id (auto increment primary key to uniquely identify the post)
  • title (a title for the content)
  • content (the actual content)
  • file_name, file_type, file_size (optional resources)
  • user_id (foreign key, a post belongsTo an identified admin user responsible for the post, an admin user potentially hasMany posts)
    Comments table:

  • id (auto increment primary key to uniquely identify the comment)
  • post_id (foreign key, a comment belongsTo a post and a post potentially hasMany comments)
  • user_id (foreign key, a comment belongsTo an identified user responsible for the comment and a user potentially hasMany comments)
  • comment (the text or the comment or query added by the user)
  • created (timestamp)
  • modified (timestamp)
    Users table:

  • id (auto increment primary key to uniquely identify the user)
  • name (eg”real” name)
  • username (for login)
  • Password (encrypted)
  • role (user type information)

A user potentially hasMany posts and potentially hasMany comments.

Remove Diagnostics

To remove diagnostics from the bottom of every page, core.php file should be edited:
Configure::write(‘debug’, 0);

The original ‘debug’ value was 2 which allowed the debugging tools to run. 0 value disables the debugging tools from operating. This stops any error messages developer get when the code is wrong.

Conclusions

I have created a basic CakePHP application. Users can post information about football players and comment on them. I have added a login and registration features. I have also completely overhauled the look and the style of the website with my website being unrecognisable from the uscms26 handed out by the lecturer.

As for the application I do think it is the start of something decent. I was surprised to see that tables might still have a place in modern web development. I also learned how to create a login system and learned about the AuthComponent method that gives the access to the current logged in user. Without that i couldn’t have achieved most of what i did.
Customising the CSS is time-consuming process, both in terms of CSS and it’s limits for layouts, and in terms of dealing with CakePHP’s large amount of CSS. Therefore the style of my site is quite basic.

The following project was very interesting because even without having a deep knowledge about php, I have developed a USCMS application quite smoothly (something that will be impossible without a framework like CakePHP).

It was a little bit difficult first to learn and follow the conventions, but later every developer can see that this saves lot of work. Helpers are also very useful and facilitate the work for common tasks in a typical web development. The advantage is that developers can easily develop a well-structured application very quickly. In the other hand the disadvantage is that developers need to fit with the conventions and follow them, which maybe is not appropriate for some kind of projects where more flexibility is needed.