Posts

Create Your Own PHP MVC

Image
Code Your Own PHP MVC Framework in 1 Hour MVC architectural pattern M: Model V: View C: Controller The core concept of MVC is to separate business logic from displaying(the View part). First let me explain the whole workflow of an HTTP request & HTTP response. For example, we have a commerce website and we want to add a certain product. A very simple URL would be look like this: http://bestshop.com/index.php?p=admin&c=goods&a=add http://bestshop.com is the domain name or base URL; p=admin means the Platform is admin panel, or the Backend site of the system. We also have a Frontend site, which is public to the world(in this case, it would be p=public) c=goods&a=add means this URL requests the ‘goods’ Controller’s add action method. Front Controller Design Pattern What is index.php in the above example? This file is called ‘Front Controller’ in PHP’s MVC frameworks. The name is usually index.php, but you can name it something else(few people d...

Pictures from a developer’s life

Image
When I show the boss that I have finally fixed this bug When the project manager enters the office When I’m deploying code to production When I try to fix a bug at 3 in the morning When my regex returned exactly what I expected When a friend of mine asks me to fix his website built with Joomla When I’m told that the module on which I have worked all the week will never be used When the code that I have not tested on dev works perfectly in production When the sales people announce they have sold our product to the customer When I apply a new CSS for the first time When sysadmin finally gives us the root access When I launch my script for the first time after several hours of development When I go off for the weekend while everyone else is still trying to fix bugs When the app goes into beta and the first bug reports arrive When the boss is looking for someone to urgently fix a difficult bug When a thing that worked on Friday no longer works...