tags:

views:

51

answers:

4

I need some background information about CakePHP, and how it works...

let's say that i have method (function) defined in CakePHP's controller, ie. deleteItem, like

function deleteItem( $id = null ) 
{
    $this->PublicationNumeration->delete( $id, true );
}

The CMS I developed works ok, proper record is deleted ($id), and it works fine.

But if I try to call this method from browser, I am getting the error 'page not found'.

Is it possible to skip that error (no matter how)?

+3  A: 

For development mode, set debug value to 2 in app/config/core.php:

Configure::write('debug', 2);

If you set debug value to 2, you can get detailed message of what happening. From your description, there are two possibilities:

  1. record with given id has been deleted, or
  2. view from current action is not exist. Usually in delete action, you don't create view but redirect it to somewhere else (which you not do in code above).
Jamal Aziz
very likely reason #2
harpax
nope. as i said, page exists. method exists. it works if i call it from caphp application, it works. but if i call it directly from browser, i get error "page not found".
please set debug value to 2 and post here the error message so we can get detailed information on what happens.
Jamal Aziz
A: 

If you want, you can create your own custom error pages in /views/errors

DavidYell
A: 

Make sure you're including the controller's name in the URL as well. If your controller's class name is CategoriesController and you want to delete an item with an ID of 4, for example, make sure you're going to this address in the browser:

http://www.example.com/categories/deleteItem/4
Justin Russell
A: 

The page is not found because you haven't created it (deleteItem.ctp). After the delete statement, put a redirect to the page you want to return to, usually an index page after a delete operation.

Leo