Introduction MVC & CakePHP

download Introduction MVC & CakePHP

of 39

  • date post

    17-Dec-2014
  • Category

    Documents

  • view

    2.541
  • download

    2

Embed Size (px)

description

 

Transcript of Introduction MVC & CakePHP

  • 1. Hi!Saturday, 19 January, 13
  • 2. Im Myat Min Han aka Mike @mmhan http://mmhan.netSaturday, 19 January, 13
  • 3. Introduction to MVC & CakePHP BarCamp Yangon 2013Saturday, 19 January, 13
  • 4. Im going to assume: You dont know MVC and CakePHP You know PHP You (or want to) develop web applications You want to deliver a project quickly.Saturday, 19 January, 13
  • 5. MVCSaturday, 19 January, 13
  • 6. To Show a random JokeSaturday, 19 January, 13
  • 7. To Show a random JokeSaturday, 19 January, 13
  • 8. To Show a random Joke 1 - Browser Sends RequestSaturday, 19 January, 13
  • 9. To Show a random Joke 1 - Browser Sends Request 2 - Controller ask for a random JokeSaturday, 19 January, 13
  • 10. To Show a random Joke 1 - Browser Sends Request 2 - Controller ask for a random Joke 3 - Controller Receives a random jokeSaturday, 19 January, 13
  • 11. To Show a random Joke 1 - Browser Sends Request 2 - Controller ask for a random Joke 4 - Controller sends the Joke to View 3 - Controller Receives a random jokeSaturday, 19 January, 13
  • 12. To Show a random Joke 5 - View shows the joke to browser. 1 - Browser Sends Request 2 - Controller ask for a random Joke 4 - Controller sends the Joke to View 3 - Controller Receives a random jokeSaturday, 19 January, 13
  • 13. In a nutshell Model - Business Logic Controller - Handling Transactions and requests View - Presentation LayerSaturday, 19 January, 13
  • 14. CakePHPSaturday, 19 January, 13
  • 15. What is CakePHP? Open-source MVC PHP Development Framework for web applications. Modeled after concepts of Ruby on Rails Released in 2005Saturday, 19 January, 13
  • 16. Creating a WebApp Awesome Random JokeSaturday, 19 January, 13
  • 17. Download CakePHP Framework Download from http://cakephp.org Or git clone git://github.com/cakephp/cakephp.git random_jokesSaturday, 19 January, 13
  • 18. Create a table in a new database CREATE DATABASE `awesome_jokes`; CREATE TABLE `jokes` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(150) DEFAULT NULL, `body` text, `created` datetime DEFAULT NULL, `modified` datetime DEFAULT NULL, PRIMARY KEY (`id`) );Saturday, 19 January, 13
  • 19. Configuring Database app/Config/database.phpSaturday, 19 January, 13
  • 20. Checkout the site http://localhost/random_jokes/Saturday, 19 January, 13
  • 21. Lets start baking In Console (Or Command Prompt)Saturday, 19 January, 13
  • 22. Follow the instructionsSaturday, 19 January, 13
  • 23. Generated List : http://localhost/random_jokes/jokes/Saturday, 19 January, 13
  • 24. Generated New: http://localhost/random_jokes/jokes/add/Saturday, 19 January, 13
  • 25. Generated Edit: http://localhost/random_jokes/jokes/edit/Saturday, 19 January, 13
  • 26. Generated View: http://localhost/random_jokes/jokes/view/Saturday, 19 January, 13
  • 27. Blank jokesSaturday, 19 January, 13
  • 28. Edit the Model file app/Model/Joke.php Add validation rulesSaturday, 19 January, 13
  • 29. Give it a try New: http://localhost/random_jokes/jokes/add/Saturday, 19 January, 13
  • 30. Showing Random JokeSaturday, 19 January, 13
  • 31. Showing Random Joke app/Model/Joke.php Add the business logic to modelSaturday, 19 January, 13
  • 32.