
The controller

The add new post

The blog index
I left the office at 5.30pm and arrive at my wife's office area arounf 6pm, then she informed me that she will be late. Luckily there's a mamak stall nearby. I ordered a Roti Telur and Teh Tarik ( typical Malaysian fast food ) and turn on my Laptop.
Okay, to kill the time ahead of me, I'll will write a blog system for my Mamak Spot Wifi Controller. Fired up Firefox and pointed to PhpMyAdmin installed locally on my pc.
So I create a blog_posts table consists of
1. id
2. title
3. body
4. created
5. modified
Then I create my BlogPost model in /app/model as blog_post.php.
Notice that I use $scaffold in the controller. Then I point to http://localhost/blog_posts and tadaaa, the basic CRUD interface is there. But I need to customize the index layout, so that it will bring a basic blog interface. So I have to create a folder inside /views as blog_posts and create a new file named index.ctp
Save the file, refresh the browser. Tadaaa, a nice blog interface.
The phone rang again, okay, time to pickup my wife and I manage to kill my 1 hour waiting by writing a simple blog complete with CRUD functions.
MamakSpot prepaid is targeted to people who wants to run prepaid business using Wifi. Admin can create X numbers of prepaid and registered or public users can buy the prepaid for their internet usage? That is nice and great!
ReplyDelete