Re: Blog tutorial: Missing argument 1 for PostsController::delete()

2010-08-23 Thread Mike Karthauser

On Mon, August 23, 2010 11:56 am, psybear83 wrote:
>> i think problem is here.your link should look like
>> "controller/action/params" so in your case: posts/delete/post_id
>
> Thanks, this works! However, I didn't write the code myself but it was
> generated using bake. So I guess there's some bug in the current Cake
> version... The code that it's using is:
>
>   link(
>   'Delete',
>   array('action'=>'delete', 
> 'id'=>$post['Post']['id']),
>   null,
>   'Are you sure?'
>   )?>
>
> ...which generates posts/delete/id:X instead of posts/delete/id. How
> can I fix that?

Html->link(__('Delete', true), array('action' =>
'delete', $id), null, sprintf(__('Are you sure you want to delete # %s?',
true), $id)); ?>

is the baked version.

You wont need to define id in your link as your action doesnt require it
to be named.


>
> Thanks
> Josh
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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 For more options, visit this group
> at http://groups.google.com/group/cake-php?hl=en
>
>


-- 
Mike Karthauser
Managing Director - Brightstorm Ltd

Email: mi...@brightstorm.co.uk
Web: http://www.brightstorm.co.uk
Tel:  07939 252144 (mobile)
Fax: 0870 1320560

Address: 1 Brewery Court, North Street, Bristol, BS3 1JS

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Blog tutorial: Missing argument 1 for PostsController::delete()

2010-08-23 Thread psybear83
> i think problem is here.your link should look like
> "controller/action/params" so in your case: posts/delete/post_id

Thanks, this works! However, I didn't write the code myself but it was
generated using bake. So I guess there's some bug in the current Cake
version... The code that it's using is:

link(
'Delete',
array('action'=>'delete', 
'id'=>$post['Post']['id']),
null,
'Are you sure?'
)?>

...which generates posts/delete/id:X instead of posts/delete/id. How
can I fix that?

Thanks
Josh

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Blog tutorial: Missing argument 1 for PostsController::delete()

2010-08-20 Thread Tilen Majerle
Warning (2): Missing argument 1 for PostsController::delete() [APP
\controllers\posts_controller.php, line 24]
Code

i think problem is here.your link should look like
"controller/action/params" so in your case: posts/delete/post_id


--
LP,
Tilen Majerle http://majerle.eu


2010/8/20 psybear83 

> Hi everybody
>
> I'm learning CakePHP and I'm reading through the Blog tutorial. So far
> everything works well, except the delete action. When clicking on
> Delete, I get the following errors:
>
> Warning (2): Missing argument 1 for PostsController::delete() [APP
> \controllers\posts_controller.php, line 24]
> Code
>
>}
>
>
>
>function delete($id) {
>
> PostsController::delete() - APP\controllers\posts_controller.php, line
> 24
> Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
> Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
> [main] - APP\webroot\index.php, line 83
>
> Notice (8): Undefined variable: id [APP\controllers
> \posts_controller.php, line 25]
> Code
>
>
>
>function delete($id) {
>
>$this->Post->delete($id);
>
> PostsController::delete() - APP\controllers\posts_controller.php, line
> 25
> Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
> Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
> [main] - APP\webroot\index.php, line 83
>
> Notice (8): Undefined variable: id [APP\controllers
> \posts_controller.php, line 26]
> Code
>
>function delete($id) {
>
>$this->Post->delete($id);
>
>$this->Session->setFlash('The post with id: '.$id.' has been
> deleted.');
>
> PostsController::delete() - APP\controllers\posts_controller.php, line
> 26
> Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
> Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
> [main] - APP\webroot\index.php, line 83
>
> Warning (2): Cannot modify header information - headers already sent
> by (output started at C:\xampp\htdocs\josh\blog\cake\libs\debugger.php:
> 673) [CORE\cake\libs\controller\controller.php, line 746]
> Code | Context
>
> $status =   "Location: http://localhost/josh/blog/posts";
>
> header - [internal], line ??
> Controller::header() - CORE\cake\libs\controller\controller.php, line
> 746
> Controller::redirect() - CORE\cake\libs\controller\controller.php,
> line 725
> PostsController::delete() - APP\controllers\posts_controller.php, line
> 27
> Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
> Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
> [main] - APP\webroot\index.php, line 83
>
> Any idea what's the problem? Something with the routing, maybe?
>
> Thanks
> Josh
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en