Making My CMS with CakePHP
if ($error): echo " Login denied. Please try again. "; endif; echo $form->create('Member',array('type' => 'post', 'action' => 'login', 'id' => 'MemberLogin')); echo $form->inputs(array('Member.email','Member.password','legend' => 'Member Login')); echo $form->end('Login'); ?>
6 lines of code (if even want to call it that). For a login form with email field, password field, submit button and form opening and closing tags. It also adds in the correct labels for each form field, css div labels and a legend div around all the inputs. If i wanted I could make an entire table go into the fields just by specifying a model name, and then adding an array to exclude the columns I don’t want in there.
This is what I was working on today. After a little bit of trouble to figure out what was going on I quickly realized everything in CakePHP is about 50x easier that I think it is going to be. It almost feels like I am cheating on normal PHP with its better looking older sister. Thus far I have not written any sql my self and I already have linked up 5 database tables together so that when I look up info on say an event, the pictures(which exist within a gallery) come up. Also it brings up who wrote event or article or whatever. I realize this is a lot like the ruby on rails model, but you know its awesome none-the-less. I can’t wait to get this CMS out of the way so I can start sprucing it up with some cool ajax things that cake has built in.
Right now I am working on using their sanatize classes to prevent SQL injection and their validation classes to help with user sign up! This is truely awesome!
I am currently using Cake PHP 1.2 RC2. Bottom line… It rocks!
Leave a Reply
You must be logged in to post a comment.