Re: Tutorial: ControlPanel
About the bakery... uhm... is too troublesome and i'm wasting too much time checking if all the post and codes follows the rules of the community... i just wanted to share what i had done for other users to understand how to work with CakePHP with some nice example that covers quite a big part of the basic functionalities to perform a website on CakePHP as for some people the beginning is quite complex and there are many doubts... so... i really don't want to waste my time checking if my post is alright or not at the bakery, just cancel it if you want. My code is writen here at this threat on Google Group, so if it helps to somebody is alright, if not, is ok. Best Regards, Rohman --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
RE: Tutorial: ControlPanel
If you are in such a hurry you should consider checking the comments on the article, and also you have checked "I agree to The Bakery Guidelines (http://bakery.cakephp.org/pages/guidelines)" but still somehow the code does not follow CakePHP Coding Standards (https://trac.cakephp.org/wiki/Developement/CodingStandards). So as I said on the Article: "The code is still not following CakePHP Coding Standards, and most importantly, the source code should not be PHP5 dependent (so remove declarations such as public)" PS: Coming from a family of lawyers YOU SHOULD ALWAYS READ WHAT YOU ARE AGREEING TO ;) -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! blog: http://www.MarianoIglesias.com.ar -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de R. Rajesh Jeba Anbiah Enviado el: Lunes, 30 de Abril de 2007 03:06 a.m. Para: Cake PHP Asunto: Re: Tutorial: ControlPanel Please approve the article. I'm getting "Unable to provide the article you requested; it is currently pending approval for public viewing" --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Tutorial: ControlPanel
Well, I think is just a matter of time, wait a little until it gets approved (^-^) Anyway, you have all the code written here too, so you can check it! Regards, Rohman --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Tutorial: ControlPanel
On Apr 29, 3:19 pm, "Mariano Iglesias" <[EMAIL PROTECTED]> wrote: > > > Ok, already added into the Bakery: > > > > http://bakery.cakephp.org/articles/view/tutorial-control-panel > > I added comments to the article. If you have CHECKED the "I agree to The > Bakery Guidelines" then the article should follow them, which it does not. > Also use BBcode to format the article content. Please approve the article. I'm getting "Unable to provide the article you requested; it is currently pending approval for public viewing" -- Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Tutorial: ControlPanel
Sorry, it was my first time adding something into the Bakery, so i'm sorry if i did something wrong (><) Best Regards, Rohman --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
RE: Tutorial: ControlPanel
I added comments to the article. If you have CHECKED the "I agree to The Bakery Guidelines" then the article should follow them, which it does not. Also use BBcode to format the article content. -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! blog: http://www.MarianoIglesias.com.ar -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de ??? Enviado el: Domingo, 29 de Abril de 2007 06:57 a.m. Para: Cake PHP Asunto: Re: Tutorial: ControlPanel Ok, already added into the Bakery: http://bakery.cakephp.org/articles/view/tutorial-control-panel --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Tutorial: ControlPanel
Ok, already added into the Bakery: http://bakery.cakephp.org/articles/view/tutorial-control-panel Regards, Rohman --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Tutorial: ControlPanel
You may consider to add it to the bakery. -- Daniel Hofstetter http://cakebaker.42dh.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Tutorial: ControlPanel
Dear mates, I started coding with CakePHP around 5 days ago and sometimes with the help of the people of that Google Group I could make a quite nice and useful ControlPanel. I know is not perfect and some things should been done on better ways, but i though is a good example for newbies to understand how to work with CakePHP, as that ControlPanel covers Sessions, Login Function, Validation, Database Listing, Create/Edit/ Delete Entries, Search Engine, Error Handle, even easy Pagination system!!! So, I think is a nice work for newbies, as many of all questions are solved in some easy way, hope it is usefull for everybody. My ControlPanel is much bigger, but is always the same, so i just put the "Categories" section (^-^) - First we start with the 2 models and their mysql Database tables: - One tricky thing on CakePHP is that tables always has to use the plural, so... the Admin model calls the Database Table admins, and so the Category model calls the Database categories table [ not "categorys"!!! ] Another Important thing, all tables requires a Primary Key called ID. CREATE TABLE admins ( id VARCHAR(20) NOT NULL, /* Admin Username [ ID ] */ pass VARCHAR(20) NOT NULL, name VARCHAR(50), email VARCHAR(150), dcp TEXT, <- this is just a description, for memo PRIMARY KEY(id) ); CREATE TABLE categories ( id MEDIUMINT NOT NULL auto_increment, /* Just a numerical ID [ 1,2,3,4... ] */ name VARCHAR(30) NOT NULL, dcp TEXT, PRIMARY KEY(id) ); ALTER TABLE categories ADD UNIQUE (name); /* We don't want diferent categories with same name */ // CakePhp/app/models/admin.php <- The model file is written in Singular // CakePhp/app/models/category.php VALID_NOT_EMPTY /* On the Insert Form we require that "name" is not null */ ); } ?> - Ok, now we go for the 1st Controller [ place where the code is written ] :: ADMINS - The controllers filenames are writen with this pattern: database-table- in-plural_controller.php Another important thing I forgot to mention before, is that normally, for calling the functions on the website, should be something like: http://www.yoursite.com/CakePhp/categories/new http://www.yoursite.com/CakePhp/categories/edit http://www.yoursite.com/CakePhp/admins/login but I wanted to create a folder for grouping all the functions together... in my case "Kanri" [ means "Management" in Japanese ]... for that [ without using setting up the Admin param on core.php, so you can make as many groups as you want!! ] i only had to name my functions as "kanri_new", etc... so... my URLs automatically became: http://www.yoursite.com/CakePhp/kanri/admins/login http://www.yoursite.com/CakePhp/kanri/categories/new http://www.yoursite.com/CakePhp/kanri/categories/edit // CakePhp/app/controllers/admins_controller.php pageTitle = 'mytyLife管理'; /* Title of the page [ for the Html tag inside ] */ $lifekanri = $this->Session->read('lifekanri'); /* We read the session var "lifekanri" to see if we are logged in */ if ($lifekanri != 'si') /* If we are not logged in... 'si' is 'yes' in spanish */ { if($this->data) /* If we received some data from the HTML Form */ { $results = $this->Admin->findById($this->data['Admin'] ['id']); /* Way of making a Select on CakePhp... is the same as SELECT * FROM admins WHERE id = data['Admin']['id'] */ if ($results && $results['Admin']['pass'] == $this- >data['Admin']['pass']) { $this->Session->Write('userid',$this->data['Admin'] ['id']); $this->Session->Write('lifekanri','si'); /* Login is valid, so we set the session var "lifekanri" to 'si' [ yes ] */ $this->redirect('kanri/admins/index'); /* redirection to index page [ function ] */ } else { $this->Session->Write('lifekanri','no'); } } } else { $this->redirect('kanri/admins/index'); } /* If we are logged in, just jump to index */ } public function kanri_index() /* This function says hello to the admin and show the list of Categories we have */ { $this->pageTitle = 'mytyLife管理'; $lifekanri = $this->Session->read('lifekanri'); if ($lifekanri == 'si') { $id = $this->Session->read('userid'); if ($id) { $results = $this->Admin->findById($id); $this->set('admin',$results['Admin']); /* That's for saying "Welcome," */ $results = $this->Categ