Hello, im solving that, thanks you very much. Is there any form to catch php fatal errors? i heard that if you left a blank space after ?> tag, it can causes a fatal error.
Trying yo depurate in local ... but im spending a lot of time in this stupid thing :( Thanks you for your time. El viernes, 4 de enero de 2013 03:50:30 UTC+1, cricket escribió: > > On Thu, Jan 3, 2013 at 6:02 AM, Pedro Fortes Gallego > <fortes...@gmail.com <javascript:>> wrote: > > Hello, > > > > Im using auth component and cofiguring it in my AppController, just cake > > documentain say. > > > > class AppController extends Controller { > > > > ... > > public function beforeFilter() { > > $this->Auth->allow('login', 'index', 'forgotPassword'); > > This should be in the UsersController, not AppController. And you > shouldn't include login in the allow() call. (I know, it's not > intuitive.) > > > white screen with no error and no debug info (trying debug to 2 - 3 and > > still no info). Im using a hoting, so its hard to access to apache log > ... > > A white screen means a fatal PHP error, so Cake doesn't have the > chance to log anything. Does your hosting account include an admin > panel with access to the server logs? > > > <?php > > class CategorysController extends AppController { > > It should be CategoriesController. > > > public $helpers = array('Html', 'Form'); > > If these two helpers are commonly used you can put this in > AppController and leave it out of all of your other controllers. > > > public $uses = array ('Category', 'Sp', 'SpsSpsPart', 'SpsPart'); > > Are the Sp, SpsSpsPart, and SpsPart models associated with each other? > And are any of them associated with Category? If so, you can remove > this entire $uses var and chain your model calls like, eg. > $this->Category->Sp->SpsPart->doSomething() > > But it doesn't even look like you're calling methods on those other > classes, anyway. > > > // public $components = array('Session', 'Auth'); > > This is not necessary here because you declared it in AppController, > which is the parent of this controller. > > > public function beforeFilter() { > > > > parent::beforeFilter(); > > $this->layout = 'login'; > > Are you sure you want the login layout for categories? > > > > public function addCategory ($sp, $spPart, $parent = 0) { > > > > if ($this->request->is('post')) { > > $this->Category->set($this->data); > > > > if ($this->Category->validates()) { > > $category = array ( > > 'sp_id' => $sp, > > 'parent_id' => $parent, > > 'sps_part_id' => $spPart, > > 'name' => $this->data['Category']['nombre'], > > 'l_name' => $this->data['Category']['nombrelatin'], > > 'description' => > $this->data['Category']['descripcion'] > > ); > > You've got this a little bit backwards. > > public function add($sp_id, $sps_part_id, $parent_id = 0) { > > if ($this->request->is('post')) { > > $this->data['Category']['sp_id'] = $sp_id; > $this->data['Category']['sps_part_id'] = $sps_part_id; > $this->data['Category']['parent_id'] = $parent_id; > // etc ... > > $this->Category->set($this->data); > > if ($this->Category->validates()) { > if ($this->Category->save()) { > > > Better: set the sp_id, sps_part_id, and parent_id as view variables > and create hidden form fields for them. They'll be in the data array > when it is submitted. > > > > public function showCategory ($sp, $spPart, $parent = null) { > > if ($parent == null) { > > $category = $this->Category->find('all', array ( > > 'fields' => array('Category.id', 'Category.sp_id', > > 'Category.parent_id', 'Category.sps_part_id', 'Category.name', > > 'Category.l_name', 'Category.description'), > > 'conditions' => array('Category.sp_id = ' .$sp . ' AND > > Category.sps_part_id = ' . $spPart.' AND Category.parent_id = 0'), > > 'conditions' => array( > 'Category.sp_id' => $sp, > 'Category.sps_part_id' => $spPart, > 'Category.parent_id' => $parent > ) > > > > }else { > > > > $category = $this->Category->find('threaded', array ( > > 'conditions' => array('Category.parent_id = ' .$parent) > > > 'conditions' => array('Category.parent_id' => $parent) > > > > public function edit ($sp, $spPart, $id) { > > > > $category = $this->Category->find('first', array ( > > 'fields' => array('Category.id, Category.sp_id, > > Category.sps_part_id, Category.parent_id, Category.name, > Category.l_name, > > Category.description'), > > 'conditions' => array ( > > 'Category.sp_id' => $sp, > > 'Category.sps_part_id' => $spPart, > > 'Category.id' => $id > > )) > > ); > > > > $this->set('category', $category); > > Everything above should come AFTER the if ($this->request->is('post')) > block. You don't want to fetch the data if the form has been posted. > > > public function result ($sp, $part, $parent = 0) { > > > > $category = $this->Category->find('all', array ( > > 'fields' => array('Category.id', 'Category.sp_id', > > 'Category.parent_id', 'Category.sps_part_id', 'Category.name', > > 'Category.l_name', 'Category.description'), > > 'conditions' => array('Category.sp_id = ' .$sp . ' AND > > Category.sps_part_id = ' . $part.' AND Category.parent_id = '. $parent), > > 'conditions' => array( > 'Category.sp_id' => $sp, > 'Category.sps_part_id' => $part, > 'Category.parent_id' => $parent > ) > > > Im using cakephp 2.1, php 5.2.1 > > Change all $this->data to $this->request->data. > > I may have missed some other things. > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.