跳至主要内容

博文

目前显示的是标签为“CakePHP”的博文

AngularJS CakePHP Sample codes

Introduction This sample is a Blog application which has the same features with the official CakePHP Blog tutorial, the difference is AngularJS was used as frontend solution, and CakePHP was only use for building backend RESR API. Technologies AngularJS   is a popular JS framework in these days, brought by Google. In this example application, AngularJS and Bootstrap are used to implement the frontend pages. CakePHP   is one of the most popular PHP frameworks in the world. CakePHP is used as the backend REST API producer. MySQL   is used as the database in this sample application. A PHP runtime environment is also required, I was using   WAMP   under Windows system. Post links I assume you have some experience of PHP and CakePHP before, and know well about Apache server. Else you could read the official PHP introduction( php.net ) and browse the official CakePHP Blog tutorial to have basic knowledge about CakePHP. In these posts, I tried to ...

Create a restful application with AngularJS and CakePHP(IV): Simple authentication and authorization

Simple authentication and authorization Now we add the basic security feature to this application, such as login, logout, only the author of the certain Post can edit and delete it. Prepare the tables Create a   users   table, reuse the one from Blog tutorial. CREATE TABLE users ( id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, username VARCHAR(50), password VARCHAR(50), role VARCHAR(20), created DATETIME DEFAULT NULL, modified DATETIME DEFAULT NULL ); Alter   posts   table, add a   user_id   column. ALTER TABLE posts ADD COLUMN user_id INT(11); Thus allow multi users to add posts. Authentication Create   User   model class. class User extends AppModel { public $validate = array( 'username' => array( 'required' => array( 'rule' => array('notEmpty'), 'message' => 'A username is required' ) ), 'password' => array...

Create a restful application with AnguarJS and CakePHP(III): Build the frontend pages with AngularJS

Build the frontend pages with AngularJS AngularJS   is one of the most popular JS frameworks, with which it is easy to build awesome single page applications. If you have no experience of AngularJS framework before, you could have to read the official AngularJS tutorial firstly and get the basic concept of AngularJS. Prepare AngularJS resources In this project, I do not want to make thing complex, so the AngularJS resources will be put in the same application. In further posts, I could move the AngularJS frontend resource into a standalone NodeJS application. You can download a copy of AngularJS seed from AngularJS Github, extract files into your local disc, and copy the app folder into   webroot folder of this project as the start point of the next steps. The   app   folder should look like. webroot /app /js app.js controllers.js directives.js filters.js services.js /img /css /lib /angular /bootstrap jquery.js /par...